Blog


Most Recent Post  |  Index List

Enjoy more REST with FNC in the cloud

Bookmarks: 

Wednesday, February 27, 2019

Intro

FNC is going to the cloud! We are currently working very hard to bring FNC to the cloud in the form of a TMS FNC Cloud Pack with a set of the most popular ready-to-use cloud service implementations, but before you can throw yourself into this new bag of FNC cloud service candies, we wanted to give you an insight on what is coming and also ask you a question on which cloud service(s) you wish to see being added in the future.

Cross-Platform / Cross-Framework

FNC (Framework Neutral Components) is not a new story, you can find all about it on this page. FNC supports the following frameworks and platforms:

  • FMX
    • Windows
    • macOS
    • iOS
    • Android
  • VCL
    • Windows
  • LCL
    • Windows
    • macOS
    • Linux
  • WEB
    • Classic
    • PWA (Progressive Web Application)
    • Electron

So with FNC for the cloud, you will be able to target all of the above Frameworks and Platforms!

Asynchronous

While working on the FNC cloud core, we wanted to make sure that each action, whether it's retrieving a list of files, or uploading/download a file, is running seamless and doesn't interfere with the main thread. This makes your application responsive at all times and allows you to perform other tasks while waiting for the download/upload to finish, or the list of files to be loaded. This also gives the advantage that you can start multiple requests at once, and not having to wait until a specific request has finished. Of course, some requests require additional data that has been retrieved via another request, but we have made the request execution and data retrieval as flexible as possible. Below is a sample that shows the way the request is being made, and how the result is captured.
procedure TRequestForm.DoRequestExecute(const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
  //File Download Finished
end;

procedure TRequestForm.DownloadFile;
var
  c: TTMSFNCSimpleCloudBase;
begin
  c := TTMSFNCSimpleCloudBase.Create;
  try
    c.Request.Clear;
    c.Request.Host := 'http://myhost.com';
    c.Request.Path := '/download';
    c.Request.Query := 'fileid=123';
    c.Request.Name := 'Download File';
    c.Request.Method := rmGET;
    c.ExecuteRequest(DoRequestExecute);
  finally
    c.Free;
  end;
end;
There is even a small bonus when targetting FMX or VCL. You can catch the result via anonymous methods as well! Anonymous methods are also coming to TMS WEB Core in a future update, so it will be possible to not only target FMX and VCL, but also have this code working for the web!
procedure TRequestForm.DownloadFile;
var
  c: TTMSFNCSimpleCloudBase;
begin
  c := TTMSFNCSimpleCloudBase.Create;
  try
    c.Request.Clear;
    c.Request.Host := 'http://myhost.com';
    c.Request.Path := '/download';
    c.Request.Query := 'fileid=123';
    c.Request.Name := 'Download File';
    c.Request.Method := rmGET;
    c.ExecuteRequest(
      procedure(const ARequestResult: TTMSFNCCloudBaseRequestResult)
      begin
        //File Download Finished
      end
    );
  finally
    c.Free;
  end;
end;

One code base

With FNC you can write your code once, and deploy it to several Frameworks / Platforms. This is also the case with FNC for the cloud. It relies on the TMS FNC Core and uses every aspect of FNC. You can write an old school VCL application and use the same code to target the recently and brand new PWA (Progressive Web Application) support in TMS WEB Core. Let us know for which Frameworks / Platforms you are writing an application with FNC.

Custom development

The FNC cloud core has been designed to allow you, as a developer, write a component for a service not supported out of the box in the upcoming TMS FNC Cloud Pack. There is already a lot of functionality built-in and accessible. The list below shows what can be done when writing your own service.

  • Make GET, POST, PUT, UPDATE, DELETE and PATCH requests
  • Support for multi-part form data via a separate form data builder class
  • Built-in OAuth 2.0 authentication flow
  • Built-in URL encoding, JSON parsing, file to Base64 encoding and many more

Let us ask you a question

We want to make sure we are not only providing a solid base for future development, we also want to know which service you are going to use. We already added a list of the most popular services, but we want to make sure that for future developments, we can accomodate to your needs. For this purpose, we want to ask you a question and vote on the service of your choice, or add a new one, if it's not already in the list. The list can be viewed at the following survey: https://www.survio.com/survey/d/N4J9X1C8L4V7K1U7V.

Additionally, if you have any feedback, please comment on this blog.

More REST

We already want to thank you for filling in the survey and/or comment on this blog. The data will provide us with knowledge on how to improve our current developments and make the TMS FNC Cloud Pack even better. After all, we want you, as a customer, to enjoy more of that hard-earned REST after a full day of development. Stay tuned for more "FNC in the cloud" content coming in the near future!

Pieter Scheldeman


Bookmarks: 

This blog post has not received any comments yet.



Add a new comment:
Author:
Email:
  You will receive a confirmation mail with a link to validate your comment, so please use a valid email address.
 
Comment:
 
 

All fields are required.
 




Most Recent Post  |  Index List