This is a setup for new projects, restricted to a certain group of developers. The use of its features depends on a preconfigured macro environment
Configure the project by replacing the {{information}} tags with your service data
npm install
npm run swagger
launch.json
{
"version": "2.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/bin/www.debug.ts",
"preLaunchTask": "buildTask",
"cwd": "${workspaceFolder}/dist",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"envFile": "${workspaceFolder}/../../variables.env"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [{
"label": "buildTask",
"command": "npm",
"args": ["run", "build"]
}, {
"label": "testTask",
"command": "npm",
"args": ["run", "test"]
}]
}
On keybord, click in button F5
npm run tsc
npm run test
npm run test:coverage
npm run doc
The project documentation will be saved under ./doc
folder.
Set value secretOrKey in file gateway-entry-external.yaml
In the database, create the following objects with their respective data, eg:
host: robbyson
database: robbyson
collection: application
ps: remove _id before insertion
db.getCollection('application').insert({
"_id": ObjectId("5c2ce40ba7fe5f26e52c295b"),
"name": "Robbyson Boilerplate",
"handle": "robbysonBoilerplate",
"__v": 0.0
});
host: robbyson
database: robbyson
collection: connection
ps: remove _id before insertion
db.getCollection(‘connection’).insert({
"_id": ObjectId("5c1b9157e175c44febfbed1b"),
"password": "{{password}}",
"database": "robbysonBoilerplate",
"server": "192.168.0.168",
"contractor": {
"_id": 1.0,
"name": "AEC"
},
"application": {
"_id": ObjectId("5c2ce40ba7fe5f26e52c295b"), // _id do objeto acima
"handle": "robbysonBoilerplate",
"name": "Robbyson Boilerplate"
},
"user": "robbyson",
"databaseType": "MONGODB",
"port": {{port}}
});
In the shell of the host application run the following script with database data created:
host: application
use robbysonBoilerplate
db.createUser({
user: "robbyson",
pwd: "{{pwd}}",
roles: [
{ role: "readWrite", db: "robbysonBoilerplate" }
]
});
In the host application create database and collection (right click):
database: *to create database (ex: robbysonBoilerplate)
collection: *to create collection (ex: collectionTest)
Put the name of the database created on the existing connection in the api-server.ts constructor
contratante.getContratantes(() => {
dataBase.connect(contratante, 'robbysonBoilerplate');
});
Put the name of the collection created in the data model
collection: 'collectionTest'
This is a command that performs a security revision in the project dependency tree
sudo npm audit fix