Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
April 10, 2019
High level overview about Nest.JS framework.
April 10, 2019
More Decks by Alfredo Bonilla
See All by Alfredo Bonilla
Other Decks in Programming
See All in Programming
See All Featured
EXPLORING NEST.JS Alfredo Bonilla @brolag
WHAT IS NEST.JS? • Nest.js is a Node.js framework written
in TypeScript for building back end applications. It combines elements of Object Oriented Programming, Functional Programming and Functional Reactive Programming. • It’s very reminicent to Angular.
WHAT DOES IT TRY TO SOLVE? • It helps providing
an opinionated architecture for complex node.js application by making easy to: • Decouple modules. • Organize code per feature. • Decouple Transfer Layer (HTTP, Web Sockets). • TypeScript.
CONTROLLERS • Controllers are responsible for handling incoming requests and
returning responses to the client.
DEPENDENCY INJECTION • Dependency Injection is the technique of supplying
a dependent object, such as a module or component, with a dependency like a service, thereby injecting it into the component’s constructor.
MODULES • A module is a class annotated with a
@Module() decorator. • The @Module() decorator provides metadata that Nest.JS makes use of to organize the application structure.
MIDDLEWARE • Middleware is a function which is called before
the route handler. • Middleware functions have access to the request and response objects, and the next() middleware function in the application’s request-response cycle.
ORM • Nest.js can be integrated with: • TypeORM •
Mongoose • Sequelize
WEBSOCKETS • Nest.js make use of socket.io package under the
hood, but also, provide compatibility with a wide range of other libraries, including native web sockets implementation.
MICROSERVICES • Nest microservice is a type of application that
uses a different transport layer than HTTP. • In general, Nest supports several built-in transporters. • This makes it easy to switch between transporters without changing the line of code.
OPEN API • The OpenAPI (Swagger) specification is a powerful
definition format to describe RESTful APIs. Nest provides a dedicated module to work with it.
CQRS • Command Query Responsibility Segregation (CQRS) is the idea
that each method should either be one that performs an action (command) or requests data (query), but not both.
TESTING • The main Nest application starter is integrated with
Jest framework to reduce an amount of overhead when it comes to start writing your tests, but still, you can get rid of it and use any other tool easily.
SERVER SIDE RENDERING • Nest.js supports Angular Server Side Rendering
by using Angular Universal features.
TOOLING Nest CLI • Nest CLI is a command-line interface
tool that helps to initialize and develop your applications. • The Nest CLI is based on the Angular Devkit package
RESOURCES • https://docs.nestjs.com/ • https://twitter.com/kammysliwiec • https://github.com/juliandavidmr/aweso me-nestjs • https://youtu.be/f0qzBkAQ3mk
• https://youtu.be/ixz0IefmecI • Book