Skip to content
Snippets Groups Projects
README.md 1.73 KiB
Newer Older
# Webservice PInSIS

Webservice that provide the data collected by agents of project PInSIS
## Dependencies:
- Use npm install to install the dependencies of nodejs
- postgres >=9.0 (not necessarily in the same computer)
  - Must be created a Database and User
### Install modules
npm install #Install node dependencies
### Create the relatios
There is a detailed documentation in the directory `db/` about how can be created/migrated the relations of the database
### Create and alter the file of configuration to access database

```bash
cp config.js.example config.js
vim config.js
```


```bash
npm start #Execute the file ./src/server.js with default parameters 
The possible parameters to execute `server.js` are:
- [-c, --config]       alternative configuration file (default: config.js)
- [-p, --port]         port where the server will listen to
- [--insecure]         allows session cookies to be passed around in insecure connections
- [--dev]              force development mode
- [-n, --num-workers]  number of worker processes to spawn
- [-d, --daemon]       start the server as a daemon
- [--pid-file]         path for the pid file when running as a daemon

## Possible errors
- The main problems verified are relationed to the database connection.
  In case of errors, verify if is possible do the connection with database
  by `psql`command (in the same user that is in configuration file).
- Another commum case is to try execute the service in a port that another
  process is alredy executing. In this case a error similar to 
  `Error: bind EADDRINUSE null:3000` will be notified.
  In this case, try alter the port that the service is provided or stop
  the other process.