Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@nestjs/platform-express
Advanced tools
Nest - modern, fast, powerful node.js web framework (@platform-express)
The @nestjs/platform-express package is a platform-specific module for NestJS that allows the framework to work on top of the Express.js web application framework. It provides the necessary adapters and interfaces to integrate NestJS with Express, enabling developers to leverage the robust features of both NestJS and Express in their applications.
HTTP Server
This feature allows you to create an HTTP server using Express as the underlying platform for your NestJS application. The code sample demonstrates how to bootstrap a NestJS application with the Express platform.
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as express from 'express';
async function bootstrap() {
const server = express();
const app = await NestFactory.create(AppModule, server);
await app.listen(3000);
}
bootstrap();
Middleware Configuration
This feature allows you to define and configure middleware in your NestJS application. The code sample shows how to implement a simple logging middleware using the @nestjs/platform-express package.
import { NestMiddleware, MiddlewareFunction, Injectable } from '@nestjs/common';
@Injectable()
export class LoggerMiddleware implements NestMiddleware {
resolve(...args: any[]): MiddlewareFunction {
return (req, res, next) => {
console.log('Request logged:', req.method, req.path);
next();
};
}
}
Request Handling
This feature enables you to handle HTTP requests and interact with the request object provided by Express. The code sample illustrates how to create a controller with a route that returns a string response.
import { Controller, Get, Req } from '@nestjs/common';
import { Request } from 'express';
@Controller('cats')
export class CatsController {
@Get()
findAll(@Req() request: Request): string {
return 'This action returns all cats';
}
}
Similar to @nestjs/platform-express, this package allows NestJS to work with the Fastify web framework instead of Express. It provides a different set of performance benefits and architectural choices, focusing on high performance and low overhead.
The express package is the underlying library that @nestjs/platform-express is built upon. It is a fast, unopinionated, minimalist web framework for Node.js and is used directly when building traditional Express applications without the additional structure and features provided by NestJS.
Koa is another web framework for Node.js, similar to Express. It is designed by the same team that created Express and provides a more modern and modular approach. While there is no official NestJS package for Koa, it represents an alternative to Express in the Node.js ecosystem.
A progressive Node.js framework for building efficient and scalable server-side applications.
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses modern JavaScript, is built with TypeScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Under the hood, Nest makes use of Express, but also, provides compatibility with a wide range of other libraries, like e.g. Fastify, allowing for easy use of the myriad third-party plugins which are available.
In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like Angular, React and Vue which improve developer productivity and enable the construction of fast, testable, extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers and tools for Node, none of them effectively solve the main problem - the architecture.
Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.
For questions and support please use the official Discord channel. The issue list of this repo is exclusively for bug reports and feature requests.
Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about support here.
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.
Nest is MIT licensed.
FAQs
Nest - modern, fast, powerful node.js web framework (@platform-express)
The npm package @nestjs/platform-express receives a total of 2,955,867 weekly downloads. As such, @nestjs/platform-express popularity was classified as popular.
We found that @nestjs/platform-express demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.