Update README.md
This commit is contained in:
parent
07baec4577
commit
41355f5708
160
README.md
160
README.md
@ -1,73 +1,127 @@
|
|||||||
<p align="center">
|
# NestJS TypeORM Boilerplate
|
||||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
Este repositório é um boilerplate para iniciar um projeto usando [NestJS](https://nestjs.com/) com [TypeORM](https://typeorm.io/). Ele fornece uma estrutura inicial para desenvolver APIs com suporte a banco de dados relacional, incluindo scripts para gerenciamento de migrações, testes, linting e formatação de código.
|
||||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
||||||
|
|
||||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
## Estrutura do Projeto
|
||||||
<p align="center">
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
||||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
||||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
||||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
||||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
||||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
||||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
|
||||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
||||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
|
||||||
</p>
|
|
||||||
<!--[](https://opencollective.com/nest#backer)
|
|
||||||
[](https://opencollective.com/nest#sponsor)-->
|
|
||||||
|
|
||||||
## Description
|
A estrutura do projeto segue as melhores práticas recomendadas pelo NestJS, incluindo a organização de módulos, controladores, serviços e entidades. O TypeORM é configurado para trabalhar com PostgreSQL, mas pode ser facilmente adaptado para outros bancos de dados suportados.
|
||||||
|
|
||||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
## Pré-requisitos
|
||||||
|
|
||||||
## Installation
|
- Node.js v16 ou superior
|
||||||
|
- npm v8 ou superior
|
||||||
|
- Banco de dados PostgreSQL
|
||||||
|
|
||||||
```bash
|
## Instalação
|
||||||
$ yarn install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running the app
|
1. Clone o repositório:
|
||||||
|
```bash
|
||||||
|
git clone https://gitea.pradoc.com.br/Rhuan/NestJS-Boilerplate.git
|
||||||
|
cd nestjs_typeorm
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
2. Instale as dependências:
|
||||||
# development
|
```bash
|
||||||
$ yarn run start
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
# watch mode
|
3. Configure as variáveis de ambiente criando um arquivo `.env` na raiz do projeto. Exemplo:
|
||||||
$ yarn run start:dev
|
```env
|
||||||
|
DATABASE_HOST=localhost
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
DATABASE_USER=seu-usuario
|
||||||
|
DATABASE_PASSWORD=sua-senha
|
||||||
|
DATABASE_NAME=seu-banco-de-dados
|
||||||
|
JWT_SECRET=sua-chave-secreta
|
||||||
|
```
|
||||||
|
|
||||||
# production mode
|
## Scripts Disponíveis
|
||||||
$ yarn run start:prod
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test
|
### Desenvolvimento
|
||||||
|
|
||||||
```bash
|
- Iniciar o servidor em modo de desenvolvimento:
|
||||||
# unit tests
|
```bash
|
||||||
$ yarn run test
|
npm run start:dev
|
||||||
|
```
|
||||||
|
|
||||||
# e2e tests
|
- Iniciar o servidor com depuração:
|
||||||
$ yarn run test:e2e
|
```bash
|
||||||
|
npm run start:debug
|
||||||
|
```
|
||||||
|
|
||||||
# test coverage
|
### Produção
|
||||||
$ yarn run test:cov
|
|
||||||
```
|
|
||||||
|
|
||||||
## Support
|
- Construir o projeto:
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
- Iniciar o servidor em modo de produção:
|
||||||
|
```bash
|
||||||
|
npm run start:prod
|
||||||
|
```
|
||||||
|
|
||||||
## Stay in touch
|
### Linting e Formatação
|
||||||
|
|
||||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
- Lint do código:
|
||||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
```bash
|
||||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
- Formatar o código:
|
||||||
|
```bash
|
||||||
|
npm run format
|
||||||
|
```
|
||||||
|
|
||||||
Nest is [MIT licensed](LICENSE).
|
### Testes
|
||||||
|
|
||||||
|
- Executar todos os testes:
|
||||||
|
```bash
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
|
||||||
|
- Executar os testes em modo de observação:
|
||||||
|
```bash
|
||||||
|
npm run test:watch
|
||||||
|
```
|
||||||
|
|
||||||
|
- Executar testes com cobertura:
|
||||||
|
```bash
|
||||||
|
npm run test:cov
|
||||||
|
```
|
||||||
|
|
||||||
|
- Executar testes end-to-end:
|
||||||
|
```bash
|
||||||
|
npm run test:e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
### Migrações TypeORM
|
||||||
|
|
||||||
|
- Criar uma nova migração:
|
||||||
|
```bash
|
||||||
|
npm run typeorm:create
|
||||||
|
```
|
||||||
|
|
||||||
|
- Gerar uma nova migração com base nas mudanças nas entidades:
|
||||||
|
```bash
|
||||||
|
npm run typeorm:generate
|
||||||
|
```
|
||||||
|
|
||||||
|
- Executar as migrações:
|
||||||
|
```bash
|
||||||
|
npm run typeorm:run
|
||||||
|
```
|
||||||
|
|
||||||
|
- Reverter a última migração:
|
||||||
|
```bash
|
||||||
|
npm run typeorm:revert
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Autor
|
||||||
|
|
||||||
|
[Rhuan Prado](https://gitea.pradoc.com.br/Rhuan)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Este boilerplate é uma excelente base para projetos NestJS utilizando TypeORM, com suporte completo a desenvolvimento, testes, linting, formatação e gerenciamento de migrações de banco de dados.
|
||||||
Loading…
Reference in New Issue
Block a user