It's responsible for serving the client web application and all the required API endpoints
This project uses Express over Node.js
The production environment can be overridden by creating a file named prod.env
in the project's root directory and declare the environment variables inside.
eg:
STATIC_CONTENT_PATH="../client/dist"
PORT="8080"
For jest unit testing, the test.env
file, if exists inside the project's root directory; it will override the global environment configuration.
The project supports the following environment variables:
- DATABASE_URL (required): It's the URL to the mongoDB database to be used by the project
- STATIC_CONTENT_PATH: It's the path to a static distribution folder to be served as SPA (fallback to index.html). The default value is
../client/dist
, which is the distribution folder of the client - PORT: Defines the port where application should be listening. (Default is 3001);
- HOST: Defines the host where application should be listening
A working MongoDB database URL is REQUIRED by the project to work. It is required to be defined as an environment variable
npm install
npm start
jest and supertest packages are used for unit testing
standard:
npm test
for keep running tests watching for changes:
npm run test-watch
- Handles the gateway's CRUD operations using the methods
POST
,GET
,PATCH
andDELETE
- Handles the devices's CRUD operations using the methods
POST
,GET
,PATCH
andDELETE