A progressive Node.js framework for building efficient and scalable server-side applications.
First you must to clone the repository using:
$ git clone 'https://github.com/caiquetorres/graphql-example-nestjs.git'
After that install all the required dependencies with:
$ npm install -g @nestjs/cli
$ npm install
This project uses husky's commit-msg hook. For using it run the following commands:
$ npx husky install
$ npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'
# development
$ nest start
# watch mode
$ nest start --watch
# production mode
$ nest start --prod
The application uses Docker for running some examples of databases.
Obs: Using the ".env.{database}.example" files you can copy the configuration found in those and put it in the ".env" file.
For using Postgres
$ sudo docker-compose up -d posgres
For using MySQL
$ sudo docker-compose up -d mysql
For creating a new migration run the command:
$ npm run typeorm:migrate MIGRATION_NAME
And for executing all the migrations run:
$ npm run typeorm:run
Always, when creating a new entity, create a folder in 'src/modules' with the entity name (Ex: 'src/modules/product' ). Inside the folder, it must have the following structure:
product
dtos
(All the dtos related with products)create-product.input.ts
update-product.input.ts
query-product.args.ts
entities
(All the entities related with products)product.entity.ts
resolvers
(All the resolvers related with products)product-relations.resolver.ts
product.resolver.ts
services
(All the services related with products)product-relations.service.ts
product.service.ts
product.module.ts
The application is also integrated with Sentry this way it allows tracking exceptions and storing them.
Paperbook API is MIT licensed.