Skip to content

Latest commit

 

History

History
105 lines (72 loc) · 2.2 KB

README.md

File metadata and controls

105 lines (72 loc) · 2.2 KB

EtuUTT API : NestJS & Prisma

Setup with Docker

Copy environment variables file and fill it with API keys and secrets.

cp .env.dist .env.dev
cp .env.test.dist .env.test

Start the project (add a -d flag to run it in background)

docker compose -f docker-compose.yml -f docker-compose.dev.yml up

Everytime that you up the project, it will do the following things for you in the background :

  • Check and install dependencies (Useful when installing the project for the first time or when switching branches).
  • Apply last changes on the schema.prisma to the database and update the prisma client.
  • Start Prisma Studio on port 5555.
  • Start the NestJS API in dev mode.

Push database changes

npx prisma db push

Services

You can now go to http://localhost:3000 to see the app !

Service name URL Description
API http://localhost:3000 The API home page. You can address all requests to that endpoint.
API http://localhost:3000/docs The API Swagger documentation. You can read the functional documentation and try all endpoints.

How to use

To open a terminal inside the container.

docker exec -it etu-utt-api sh

Inside that terminal, you can run any command you want, like this one to acces NestJS CLI.

npx nest

To run lint.

npm run lint

To run end to end tests (e2e) in watch mode.

npm run test:e2e

Setup manually

Setup environment variables

cp .env.example .env

Install dependencies

yarn

Setup the database

yarn prisma generate
yarn prisma db push

Start the project

# In developping mode
yarn start:dev
# In debug mode
yarn start:debug
# In production
yarn build
yarn start:prod

Contribute

To commit

git cz