platform-hyper-express is NestJS HTTP Adapter that implement hyper-express into NestJS.
hyper-express aims to be a simple yet performant HTTP & Websocket Server.
Combined with the power of uWebsockets.js - a Node.js binding of uSockets written in C++, platform-hyper-express allows NestJS Developers to unlock higher throughput for their web applications with their existing hardware.
npm i @nnmt/platform-hyper-expressUse HyperExpressAdapter for NestJS HTTP Adapter. Must require @nestjs/platform-express in dependencies.
// sample/nest-sample-1/src/main.ts
import { NestFactory } from '@nestjs/core';
import { HyperExpressAdapter } from '@nnmt/platform-hyper-express';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule, new HyperExpressAdapter());
await app.listen(3000);
}
bootstrap();Or use @nnmt/platform-hyper-express classes only to optimize hyper-express usage (Experimental).
// sample/nest-sample-2/src/main.ts
import { NestFactory } from '@nestjs/core';
import {
HyperExpressAdapter,
NestHyperExpressApplication,
} from '@nnmt/platform-hyper-express';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestHyperExpressApplication>(
AppModule,
new HyperExpressAdapter(),
);
await app.listen(3000);
}
bootstrap();- Sample projects are located in
/sampledirectory. - Sample projects help developers to install/integrate
platform-hyper-expressinto their NestJS projects. - Sample projects is not included in NPM package's source.
@nnmt/platform-hyper-expressis mostly compatible with@nestjs/platform-expressbut not 100% therefore you may encounter some middlewares not working out of the box. In this scenario, you must either write your own polyfill or omit the middleware to continue.- Currently uWebsockets.js supports only Node.js LTS versions 16, 18 and 20 on (glibc) Linux, macOS and Windows, on
Tier 1platforms. - The uWebsockets.js version header is disabled by default. You may opt-out of this behavior by setting an environment variable called
KEEP_UWS_HEADERto a truthy value such as1ortrue.
- Open an
Issuewith details about what led up to the problem including error traces, route information, etc.
To run platform-hyper-express functionality tests locally on your machine, you must follow the steps below.
- Clone the
platform-hyper-expressrepository to your machine. - Initialize and pull any submodule(s) which are used throughout the tests.
- Run
npm installin the root directory. - Run
npm installin the/testsdirectory. - Run
npm testto run all tests with your local changes.