/tempnest-prisma-graphql

基于nest+prisma+graphql的node解决方案

Primary LanguageTypeScript

Nest Logo

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

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

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.

Stay in touch

License

Nest is MIT licensed.

步骤

prisma:generate:watch 监听prisma/schema.prisma文件生成prismaclient start:dev 触发生成schema.graphql

异常过滤器

  • BadRequestException "errors": [ { "message": "Bad Request", "extensions": { "code": "BAD_USER_INPUT", "response": { "statusCode": 400, "message": "Bad Request" } } } ]
  • UnauthorizedException "errors": [ { "message": "Unauthorized", "extensions": { "code": "UNAUTHENTICATED", "response": { "statusCode": 401, "message": "Unauthorized" } } } ],
  • NotFoundException "errors": [ { "message": "Not Found", "extensions": { "code": "404", "response": { "statusCode": 404, "message": "Not Found" } } } ],
  • ForbiddenException "errors": [ { "message": "Forbidden", "extensions": { "code": "FORBIDDEN", "response": { "statusCode": 403, "message": "Forbidden" } } } ],
  • NotAcceptableException "errors": [ { "message": "Not Acceptable", "extensions": { "code": "406", "response": { "statusCode": 406, "message": "Not Acceptable" } } } ],
  • RequestTimeoutException "errors": [ { "message": "Request Timeout", "extensions": { "code": "408", "response": { "statusCode": 408, "message": "Request Timeout" } } } ],
  • ConflictException "errors": [ { "message": "Conflict", "extensions": { "code": "409", "response": { "statusCode": 409, "message": "Conflict" } } } ],
  • GoneException "errors": [ { "message": "Gone", "extensions": { "code": "410", "response": { "statusCode": 410, "message": "Gone" } } } ],
  • HttpVersionNotSupportedException "errors": [ { "message": "HTTP Version Not Supported", "extensions": { "code": "505", "response": { "statusCode": 505, "message": "HTTP Version Not Supported" } } } ],
  • PayloadTooLargeException "errors": [ { "message": "Payload Too Large", "extensions": { "code": "413", "response": { "statusCode": 413, "message": "Payload Too Large" } } } ],
  • UnsupportedMediaTypeException "errors": [ { "message": "Unsupported Media Type", "extensions": { "code": "415", "response": { "statusCode": 415, "message": "Unsupported Media Type" } } } ],
  • UnprocessableEntityException "errors": [ { "message": "Unprocessable Entity", "extensions": { "code": "422", "response": { "statusCode": 422, "message": "Unprocessable Entity" } } } ],
  • InternalServerErrorException "errors": [ { "message": "Internal Server Error", "extensions": { "code": "500", "response": { "statusCode": 500, "message": "Internal Server Error" } } } ], "errors": [ { "message": "Internal Server Error Exception", "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "response": { "code": "xxx", "msg": "mmm" }, "status": 500, "name": "InternalServerErrorException" "message": "Internal Server Error Exception" } } } ],
  • NotImplementedException "errors": [ { "message": "Not Implemented", "extensions": { "code": "501", "response": { "statusCode": 501, "message": "Not Implemented" } } } ],
  • ImATeapotException "errors": [ { "message": "I'm a teapot", "extensions": { "code": "418", "response": { "statusCode": 418, "message": "I'm a teapot" } } } ],
  • MethodNotAllowedException "errors": [ { "message": "Method Not Allowed", "extensions": { "code": "405", "response": { "statusCode": 405, "message": "Method Not Allowed" } } } ],
  • BadGatewayException "errors": [ { "message": "Bad Gateway", "extensions": { "code": "502", "response": { "statusCode": 502, "message": "Bad Gateway" } } } ],
  • ServiceUnavailableException "errors": [ { "message": "Service Unavailable", "extensions": { "code": "503", "response": { "statusCode": 503, "message": "Service Unavailable" } } } ],
  • GatewayTimeoutException "errors": [ { "message": "Gateway Timeout", "extensions": { "code": "504", "response": { "statusCode": 504, "message": "Gateway Timeout" } } } ],
  • PreconditionFailedException "errors": [ { "message": "Precondition Failed", "extensions": { "code": "412", "response": { "statusCode": 412, "message": "Precondition Failed" } } } ],