Skip to content

xgeekshq/serra-nextjs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serra-nextjs-api

Description

This is an automatic boilerplate for a new NestJS application. Please edit this docs ...

Git clone and initial setup

# 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

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

DEV mode

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.

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Test with curl

# 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/

🐳 Deploy local database

# setup you .env file

# run:
$ docker compose up -d

🐳 Build container image

# you won't need it, because there is a ci/cd job, but ...
$ docker build -t "serra-nextjs-api:0.1.0" .

Dependencies

  • postgres

Links

About

Serra-nextjs-api project repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages