An RESTful API modeling electricity price, production, and consumption based on wind speed
First, install all dependencies with
npm install
or
npm ci
then you will be able to proceed with one of the npm script in NPM scripts section below.
Command | Use case |
---|---|
npm run build |
Build the project |
npm run build && npm start |
Build and run the project |
npm test |
Run unit tests |
npm run dev |
Rebuild and restart the application when a file in the project is changed |
npm run docgen |
Build the project and generate openapi (swagger) documentation |
In order to access the API, you will need to have a valid JWT token in the authorization header.
Name | Description | Default |
---|---|---|
MONGODB_HOST |
Host with a mongo instance running, may include port number | |
MONGODB_DATABASE |
Database to use | |
MONGODB_USERNAME (optional) |
Username to access database | None |
MONGODB_PASSWORD (optional) |
Password to access database | None |
JWT_ISSUER (optional) |
Issuer to use when creating and verifying JWTs | "none" |
JWT_SECRET (optional) |
Secret to use when creating and verifying JWTs | "123" |
SWAGGER_FILE (optional) |
File to open-api swagger doc | "./openapi_doc.json" |
SIMULATOR_API_HOST (optional) |
Hostname used to access simulator API | "localhost" |
SIMULATOR_API_PORT (optional) |
Port used to access simulator API | 5500 |
Build docker image.
docker build . -t aeolus/api
Run a docker container with the newly built image and link the external port 5700 to container port 8080.
docker run -d -p 5700:8080 aeolus/api
To add enviroment variables, add --env VARIABLE=VALUE
for each enviroment variable to use.