REST server

The REST API is an alternative if you do not want to allow a direct access to your PostgreSQL server. This solution is probably a little bit slower than direct access but has two advantages:

  • You do not need to let port 5432 open
  • There is no limitation concerning number of simultaneous connections (a Postgres server usually accepts up to 100 connections at same time), since the server does not really maintain a lot of connections but a pool of them

Installation and usage

This package requires the library Perl-Dancer. For information about its installation, please refer to the site of Perl-Dancer or of your favorite OS distribution (almost Debian and RedHat/CentOS have packages for it). You will also need to install the package Perl-Dancer-Database. Note that at the time we are writing, it is the module "Dancer", not "Dancer2".

Once Dancer is installed you can run a sample server launching the file rest/cyclotis_rest_api.pl ; however, please before have a look to config.yml : you will at minima configure the database you will be connected to. Note that even if REST server can access more than one database, this requires permenant connection to them at server side: if you want to serve several Cyclotis memories, they can be in several database "schemas" (which are only namespaces), but preferably avoid to use more than one "catalog" (or only a small number of catalogs), else they will use a distinct database connection.

Once you succeeded to open this sample server, you may prefer to migrate to a more scalable server : either a Perl server like starman, or a more traditional like Apache or Nginx. Look in Dancer documentation to do that.

Executable: 

Add new comment