Node.js/Express based ReST API for CoLa project.
Especially for the Online Editor.
Rewrite, based on express-ts
For full documentation, see here.
API/Backend for VCL Frontend.
When developing locally, you need Node.js, we recommend the current ( 03.2023) LTS 18.x.
A useful tool to manage different versions of Node.js locally would be NVM.
Clone this repository and install node packages using npm.
git clone https://mode.fh-joanneum.at/cola/vcl/api-service
cd api-service
npm ci --silentNow, you can run the local development server.
npm run start:devTo build the project, run npm run build or take a look into the Docker section.
Because linting is set to force UNIX linebreak style, on windows run:
git config --local core.autocrlf falseto avoid errors.
See .env.example for custom configuration. Create a copy cp .env.example .env and setup your
configuration.
| Name | Description | Default |
|---|---|---|
| SERVICE_PORT | Port, where service is listening | 8605 |
| NODE_ENV | Set environment for application | development |
| MONGO_HOST | database url/hostname for MongoDB, should not be set when using docker-compose |
empty |
I would recommend to directly use
docker-compose.
- Build docker image
docker build --no-cache -t "vcl-api-service" .- Run docker container
docker container run -it -d -p 8605:8605 --name vcl-api-service vcl-api-serviceCheck log-output
docker container logs -f vcl-api-serviceStop container
docker container stop vcl-api-serviceWe're using Jest for testing, you can find some example tests inside of test. With the help of supertest we also can do some End2End-Testing without the need of a separate running node-server.
Run tests locally
npm testRun tests in watching mode
npm run test:watchRun tests with coverage (you can find the coverage report in test/coverage).
npm run test:coverageUse Conventional Commits specification for commit messages.
<type>([optional scope]): <description>
[optional body]
[optional footer(s)]
Types:
fix: a bugfix (add Issue number as scope, e.g.fix(#13): ...)feat: a new featureBREAKING CHANGE: a breaking changedocs: documentation only- ...