Deploy and undeploy services at runtime - loentar/ngrest GitHub Wiki

To manage services at runtime you can use ngrest::Deployment class.

An example on how to use it can be downloaded here.

Unpack and build example:

tar jxf server.tar.bz2
mkdir server-build && cd server-build
cmake ../server
make
cd deploy/bin/

Place your services into directory

mkdir services
cp ~/.ngrest/ngrest-build/deploy/share/ngrest/services/* services

Start the server

./server

Control the server with script provided in scripts directory (unpacked from archive)

$ ./serverctl list
crudservice
echoservice
favicon
ngresttestservice
serverstatus

$ ./serverctl status
serverstatus: Stopped
echoservice: Stopped
ngresttestservice: Stopped
favicon: Stopped
crudservice: Stopped

$ ./serverctl start serverstatus

$ ./serverctl status
serverstatus: Started
echoservice: Stopped
ngresttestservice: Stopped
favicon: Stopped
crudservice: Stopped

$ ./serverctl stop serverstatus

$ ./serverctl status
serverstatus: Stopped
echoservice: Stopped
ngresttestservice: Stopped
favicon: Stopped
crudservice: Stopped

When service is started you can invoke it as usual

To make /ngrest/services url working you must start serverstatus service.