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">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
# NestJS TypeORM Boilerplate
|
||||
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
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.
|
||||
|
||||
<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>
|
||||
<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)-->
|
||||
## Estrutura do Projeto
|
||||
|
||||
## 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
|
||||
$ yarn install
|
||||
```
|
||||
## Instalação
|
||||
|
||||
## Running the app
|
||||
1. Clone o repositório:
|
||||
```bash
|
||||
git clone https://gitea.pradoc.com.br/Rhuan/NestJS-Boilerplate.git
|
||||
cd nestjs_typeorm
|
||||
```
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ yarn run start
|
||||
2. Instale as dependências:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
# watch mode
|
||||
$ yarn run start:dev
|
||||
3. Configure as variáveis de ambiente criando um arquivo `.env` na raiz do projeto. Exemplo:
|
||||
```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
|
||||
$ yarn run start:prod
|
||||
```
|
||||
## Scripts Disponíveis
|
||||
|
||||
## Test
|
||||
### Desenvolvimento
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ yarn run test
|
||||
- Iniciar o servidor em modo de desenvolvimento:
|
||||
```bash
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
# e2e tests
|
||||
$ yarn run test:e2e
|
||||
- Iniciar o servidor com depuração:
|
||||
```bash
|
||||
npm run start:debug
|
||||
```
|
||||
|
||||
# test coverage
|
||||
$ yarn run test:cov
|
||||
```
|
||||
### Produção
|
||||
|
||||
## 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)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
- Lint do código:
|
||||
```bash
|
||||
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