This is an automatic boilerplate for a new NestJS application. Please edit this docs ...
# clone this repo
$ git clone https://github.com/xgeekshq/serra-nextjs-api.git
# cd into it
$ cd serra-nextjs-api
# run install script
$ ./run-install.sh
The initial script will:
- create a ".env" file from env.example
- install atlas cli (the tool to manage migrations)
- spin up a docker database, using included docker-compose.yaml file
- perform a initial database migration with "todo" entity included in demo
- run "npm install" to fetch project dependencies
- NOTE: if you get an error with db port already in use, change it in .env.example and run-install.sh again to fix it
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Every time you make changes to database schema, there is a pre-hook before each commit, that will extract the database migration file into ./database folder. Also, there is a github action that will deploy the new schema to production database.
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
# GET /todos
curl -sf -X GET \
-H "Accept: application/json" \
https://serra-nextjs-api-dev.xgeeks.tech/todos/
# POST /todos
curl -sf -X POST \
-d '{"name":"my-first-todo","description":"buy milk"}' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
https://serra-nextjs-api-dev.xgeeks.tech/todos/
# setup you .env file
# run:
$ docker compose up -d
# you won't need it, because there is a ci/cd job, but ...
$ docker build -t "serra-nextjs-api:0.1.0" .
- postgres
- Dev Team: idp_training
- Team Lead: TODO
- Website: https://serra-nextjs-api-dev.xgeeks.tech