/NestDemo

Primary LanguageTypeScript

Nest is a platform agnostic framework, means u can reuse the logical part across different platform based on the need of application

Controller are responsible for handling incoming request and return response to the client. Basically controller works as request handler and provides routing mechanism and responsible to provide suitable response for the request.

Controller uses classes and decorator, decorator to provide metadata and enable nest to create routing map. @Controller decorator to specify its a controller , you can provide metadata inside the decorator like route path prefix, path prefix helps to group and provide nesting routing.

@Get decorator in controller is same as the HTTP Get request method, you can pass route name in the decorator, nest will internally map it as the nesting routing

Nest employs two different method options for manipulating responses

  1. Standard :-
    Uses built in method , when request handler returns an object the nest will automatically serialize it into json and when returns and string it will send it directly without attempting to serialize it, which makes response handling simple. To uses various status code use @HttpCode , else it will provide response code always 200 most of the time except in the post request.
  2. Library Specific :- If you want to use the native response method by that library like Express.

Note:- Both Approaches not work at the same time.

Point to be taken Care

  1. Route Order Matters in Nest

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

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.