Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hugocruzlfc/nestjs-fundamentals-course

Official Nestjs Course!
https://github.com/hugocruzlfc/nestjs-fundamentals-course

backend-api nestjs typeorm typescript

Last synced: about 12 hours ago
JSON representation

Official Nestjs Course!

Awesome Lists containing this project

README

        


Nest Logo

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest

A progressive Node.js framework for building efficient and scalable server-side applications.

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Installation

```bash
$ npm install
```

## Running the app

```bash
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```

## Test

```bash
# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
```

## Notes on the project

### commands

```bash
nest g co modules/abc --dry-run
```

### For Validate Pipes

```bash
npm i class-validator class-transformer
```

### For extend class with PartialType

```bash
npm i @nestjs/mapped-types
```

### Add TYPEORM

```bash
npm install @nestjs/typeorm typeorm pg
```

### Create the migration

```bash
npx typeorm migration:create src/migrations/CoffeeRefactor
```

### Run the migration

```bash
npx typeorm migration:run -d dist/typeorm-cli.config
```

### Revert the migration

```bash
npx typeorm migration:revert -d dist/typeorm-cli.config
```

### Generate the migration

```bash
npx typeorm migration:create src/migrations/SchemaSync -d dist/typeorm-cli.config
```

### Generate filter

```bash
nest g filter common/filters/http-exception
```

### Generate guard

```bash
nest g guard common/guards/api-key
```

### Generate interceptor

```bash
nest g interceptor common/interceptors/transform
```

### Generate pipe

```bash
nest g pipe common/pipes/parse-int
```

### Generate middleware

```bash
nest g middleware common/middlewares/logging
```

### Adding Swagger

```bash
npm install @nestjs/swagger swagger-ui-express
```

add in nest-cli.json "compilerOptions": {
"plugins": ["@nestjs/swagger/plugin"]
}