First of all, create the .env
file (you have the example of the .env.example
file).
After starting the docker services, be sure to install the dependencies and if you want, you can run the migration to have the database structure and two registered users.
make up
or
docker-compose up -d
This will start the Node and PostgreSQL docker services.
If have error be sure that your local services (like postgreSQL) are stopped.
make down
or
docker-compose down
make run-dev
or
docker-compose exec api npm run dev
This will run nodemon with typescript in dev environment.
make run-start
or
docker-compose exec api npm run start
This will compile typescript in ./dist
folder and run nodemon with js transpiled.
make run-build
or
docker-compose exec api npm run build
This will only compile the typscript
make install
or
docker-compose exec api npm install
make eslint-check
make eslint-fix
or
docker-compose exec api npm run eslint:check
docker-compose exec api npm run eslint:fix
Rules for eslint are in .eslintrc.json
file on root path.
make run-test-unit
or
docker-compose exec api npm run test:unit
make run-test-unit-coverage
or
docker-compose exec api npm run test:unit:coverage
make migrate-backoffice-run
or
docker-compose exec api npm run migrate:backoffice:run
make migrate-backoffice-revert
or
docker-compose exec api npm run migrate:backoffice:revert
docker-compose exec api npx db-migrate create {name_of_migration}
Method:
GET
[
{
"id": "32547dd7-617a-4985-a59a-91a176e55b83",
"name": "Iván"
},
{
"id": "43ba0b24-4d0b-40f7-aa7f-1b2a3058f484",
"name": "Nabby"
}
]
Method:
GET
URL: http://localhost:8080/backoffice/users/32547dd7-617a-4985-a59a-91a176e55b83
{
"id": "32547dd7-617a-4985-a59a-91a176e55b83",
"name": "Iván"
}
Method:
POST
Body:
{
"name": "Iván"
}
No response
Method:
PUT
URL: http://localhost:8080/backoffice/users/32547dd7-617a-4985-a59a-91a176e55b83
Body:
{
"id": "32547dd7-617a-4985-a59a-91a176e55b83",
"name": "Other"
}
No response
Method:
DELETE
URL: http://localhost:8080/backoffice/users/32547dd7-617a-4985-a59a-91a176e55b83
No response