Getting started with REST (high-level framework)

Prepare an environment for testing, create the server application, and run and test the service.

If you are on a local server, you can start working with the GWS as follows:

  1. Set the runtime environment. For example, run the script file envcomp in the Genero BDL installation directory to make sure that your FGLDIR and PATH are set correctly to run compiler and runtime system tools.
  2. Set FGLAPPSERVER to 8090. This will start the GWS Server on port 8090. If this environment variable is not set, port number 80 is used.
    Warning: The user must not set the FGLAPPSERVER variable in production environments, since the port number is selected by the Genero Application Server.
  3. Set FGLWSDEBUG environment variable to 3. This ensures there is detail in the output of the HTTP requests and responses to see the interaction between the client and the server and for debugging purposes. See FGLWSDEBUG.
  4. Create your application module. For example, create a file named myService.4gl. Add service functions using the GWS REST function attributes. See the examples in the Define functions in a module section.
  5. Create the application's main service module. See Publish REST service module
  6. Compile your main application and service module.
  7. Publish the service, see Publish REST service module.
  8. To test, use the fglrun command to execute the GWS Server application in direct mode. The service and the runtime must reside on the same machine:
    fglrun <gws application>

    This will start the GWS Server on the port specified by the FGLAPPSERVER environment variable.

  9. If the GWS Server in step 2 was started on your local machine, for example, the OpenAPI information would be at:

    http://localhost:8090/<service-name>?openapi.json

    or

    http://localhost:8090/<service-name>?openapi.yaml