The main repository is hosted in gitlab.com/ravimosharksas but it is automatically mirrored to github.com/RavimoShark, gitlab.com/singletonsd, github.com/singletonsd, github.com/patoperpetua and to gitlab.com/patoperpetua. If you are in the Github page it may occur that is not updated to the last version.
This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.
Be aware to setup the configuration of the database. It can be set by database user and password as ENVIRONMENT VARIABLES or to provide your own ormconfig.json file.
After setup database configuration and running the server using either way, you can access the api under:
http://localhost:8000/
To view the Swagger UI interface:
open http://localhost:8000/docs
To use this container with docker, just type docker-compose -f docker-compose/main.yaml up
or execute the following script:
docker run -it --rm -e DB_PASSWORD= -e DB_USER=Ravimo2015 \
-p 8000:8000 \
registry.gitlab.com/ravimosharksas/apis/client/app-nodejs/alpine:8-alpine-latest
Docker images run using Docker Node Official Images and Docker Keymetrics PM2 Official Images.
You can choose to execute the server in two different operative systems:
- alpine: it uses base image node:-alpine. Available versions:
- 8-alpine
- 10-alpine
- stretch: it uses base image node:-stretch. Available versions:
- 8-stretch
- 6-stretch
To run the server, type:
npm install
npm start
API_VERSION
: api version image. Default: latest.API_BASE
: api base image (alpine or stretch). Default: alpine.SWAGGER_URL
: url of api.APP_PORT
: port to connect to the api. Default: 8000.HOST_PORT
: port to map to host. Default: 80.DB_USER
: user for database connection.DB_PASSWORD
: password for database connection.
You can provide your own ormconfig.json file to connect with a database. Use the following example configuration to create that file and put it in the root folder.
{
"name": "default",
"type": "mssql",
"host": "",
"port": 1433,
"username": "",
"password": "",
"database": "",
"options": {
"encrypt": true
},
"schema": "dbo",
"synchronize": false,
"logging": "WARN"
}
- MASTER BRANCH:
- It creates a docker image using the following tags:
- ravimosharksas/apis/client/app-nodejs:latest.
- It creates a docker image using the following tags:
- DEVELOP BRANCH:
- It creates a docker image using the following tags:
- ravimosharksas/apis/client/app-nodejs:develop.
- It creates a docker image using the following tags:
- Default branch when pull is DEVELOP.
- Master branch is protected and it is not possible to push. Create a merge request instead.
Generates an nodejs server of the provided spec. It contains the following options inside a file called .env.swagger :
SWAGGER_API_SPEC=#location of spec, it can be local or url
SWAGGER_REPO=#repository name
It can be downloaded by:
mkdir -p scripts && \
curl -o scripts/swagger_binaries_downloader.sh -L https://singletonsd.gitlab.io/scripts/swagger/latest/swagger_binaries_downloader.sh && \
curl -o scripts/swagger_generate_angular.sh -L https://singletonsd.gitlab.io/scripts/swagger/latest/swagger_generate_nodejs.sh && \
chmod +x scripts/swagger_binaries_downloader.sh scripts/swagger_generate_nodejs.sh && \
./scripts/swagger_generate_nodejs.sh
You can create docker images locally by executing the following script:
npm run docker-download #only first time
npm run docker-generate #once download was executed.
- Setup docker image.
- Setup test environment.
- Connect Database with an ORM.
- Add lint rules.
- Config TS.
- Config Keyclock to authenticate.
© Singleton SD, France, 2019.