NestJS is a framework for building server-side applications with Node.js — and it brings something Node.js usually lacks: structure. It borrows ideas from Angular: modules, controllers, services, and dependency injection. The result is a backend that stays organised as it grows, instead of turning into a folder of unrelated route handlers.
A NestJS app is built from small, clear pieces. Here is a tiny controller that returns a greeting:
import { Controller , Get } from '@nestjs/common' ;
@Controller ( 'hello' ) export class HelloController { @Get ( ) getHello ( ) : string { return 'Hello from NestJS!' ; } }
Enter fullscreen mode
Exit fullscreen mode
@Controller('hello') says this class handles requests to /hello , and @Get() says this method answers GET requests.…