ngsi-proxy v1.2.2
ngsi-proxy
The Orion Context Broker is a
great piece of software for managing context information. Using the RESTful API
provided from a web browser is easy and can also be simplified by the use of
some library (e.g. ngsijs). However,
there is a limitation, Orion uses POST request for sending notifications. This
notification mechanism makes imposible to directly receive them on a web page.
This NGSI proxy creates a server that is capable of receiving POST
notifications and redirect them to web pages through an
Event Source endpoint.
Usage
You can install the latest stable version of the ngsi-proxy by issuing the
followign command:
$ npm install -g ngsi-proxyOnce installed, you will be able to run the ngsi-proxy server by directly
using the ngsi-proxy command. By default, it will be listening on port 3000,
but you can change it by setting the PORT environment variable:
$ PORT=10000 ngsi-proxyngsi-proxy will ignore X-Forwarded-* headers by default. If you need to
deploy ngsi-proxy behind a front-end web server, like Apache or Nginx, you can
enable those headers by setting the TRUST_PROXY_HEADERS environment variable:
$ TRUST_PROXY_HEADERS=1 ngsi-proxyYou can use a process manager (e.g. pm2) for
running ngsi-proxy in a production environment:
$ npm install -g pm2
$ pm2 startup
$ pm2 start ngsi-proxy
$ pm2 saveTake a look into the pm2's documentation for a full list of options.
Running using docker
ngsi-proxy can also be deployed using a docker container. Take a look into the docker image documentation.
Running from source code
If you want to test the latest development version of the ngsi-proxy you will
have to download the git repo by issuing the following command:
$ git clone https://github.com/conwetlab/ngsi-proxy.gitOnce downloaded, you have to install some dependencies:
$ cd ngsi-proxy
$ npm installFinally, you will be able to manually run the ngsi-proxy service:
$ node app.js