As a beginner why we must choose the Nest js framework for Node js implementation for the backend…

Modules

Providers

Controllers

import { Body, Controller, Get, HttpException, Post} from ‘@nestjs/common’;import {CustomerCreateDto} from ‘./customerCreate.dto’import { UserService } from ‘src/user/user.service’;@Controller(‘user’)export class UserController {constructor(private userService: UserService){}@Get()async getAllUsers():Promise<User[]>{return this.userService.getAllUsers();}@Post()async createUser(@Body() userCreateDto:UserCreateDto){const user = await this.userService.createUser(userCreateDto);if(!user){return new HttpException(“Not created”,204);}return user;}}

What is NestJS?

  • NestJS is an open-source
  • NestJS is an extensible
  • NestJS is a versatile
  • Progressive Node.js framework for creating compelling and demanding backend systems.
  • It is currently the fastest-growing Node.js framework in TypeScript.
  • Nest js applications are easy to maintain and highly scalable frameworks.
  • Nest js methods are asynchronous. Those asynchronous methods can handle in two ways
async getAllFeedbacks(){
return await this.feedbackRepository.findAll();
}
async getAllFeedbacks():Peomise<Feedback[]>{const feedbacks = await this.feedbackRepository.findAll();

return feedbacks;
}

Opinionated Frameworks:

  • Best practices are defined upfront and are usually tried and true.
  • The framework designers have built a “happy pat” making development easier and faster.
  • Usually includes lots of functionality ou of the box.
  • If you must do something unusual that is outside the scope of the framework it will require extra work.
  • Usually larger framework size
  • May require optimization/cashing in order to archive required performance.

Un-opinionated Frameworks

  • You are free to define your own architecture, structure, etc.
  • Smaller and more lightweight footprint as you only have the core package included.
  • Usually better performance out-of-the-box due to smaller footprint and number of libraries.
  • Requires solid software engineering skills to create, manage, and maintain the architecture and structure.
  • More choices to make regarding liberties to install, best practices to choose from, etc.
  • Project type (standard or highly customized)
  • Development team experience
  • time frame
  • Scalability requirements
  • Tech stack requirements

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store