Skip to content

Standalone HTTP server

Dmitry edited this page Sep 30, 2016 · 2 revisions

It's possible to run your services with executable without using ngrestserver or web server module.

Download example

Here is the working example on how to create standalone server.

Unpack, build and start

Unpack and build from shadow directory:

unzip calc-standalone.zip
mkdir calc-standalone-build
cd calc-standalone-build
cmake ../calc-standalone
make

Start the standalone server:

deploy/bin/calc

Your service must be available by this URL: http://localhost:8080/calc/echo?text=test

Adding the services

To add new services you must create additional .h and .cpp files witin calc/src dir. Every .h file which provides a service must be added into CALC_HEADERS variable in CMakeLists.txt.

Deploy to the other host

The standalone server is depends on few ngrest libraries, so if you plan to deploy it to the other host, you must copy dependencies from ~/.ngrest/ngrest-build/deploy/lib/ such as: libngrestutils.so libngrestcommon.so libngrestengine.so libngrestjson.so.