https://github.com/cpfriend1721994/platform-hyper-express
Hyper-express Adapter for NestJS (@nnmt/platform-hyper-express)
https://github.com/cpfriend1721994/platform-hyper-express
express high-performance http-server hyper-express nestjs nestjs-package npm npm-package typescript
Last synced: 4 months ago
JSON representation
Hyper-express Adapter for NestJS (@nnmt/platform-hyper-express)
- Host: GitHub
- URL: https://github.com/cpfriend1721994/platform-hyper-express
- Owner: cpfriend1721994
- License: mit
- Created: 2024-04-01T08:06:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T07:53:41.000Z (about 2 years ago)
- Last Synced: 2025-10-22T09:37:27.933Z (8 months ago)
- Topics: express, high-performance, http-server, hyper-express, nestjs, nestjs-package, npm, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@nnmt/platform-hyper-express
- Size: 33.2 KB
- Stars: 16
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hyper-express Adapter for NestJS
[](https://www.npmjs.com/package/@nnmt/platform-hyper-express)
[](https://www.npmjs.com/package/@nnmt/platform-hyper-express)
[](https://github.com/cpfriend1721994/platform-hyper-express/issues)
[](https://github.com/cpfriend1721994/platform-hyper-express/blob/master/LICENSE)
[](https://github.com/cpfriend1721994/platform-hyper-express/releases)
[](https://github.com/cpfriend1721994/platform-hyper-express/stargazers)
## Motivation
**`platform-hyper-express`** is [**`NestJS HTTP Adapter`**](https://docs.nestjs.com/faq/http-adapter) that implement hyper-express into NestJS.
[**`hyper-express`**](https://github.com/kartikk221/hyper-express) aims to be a simple yet performant HTTP & Websocket Server.
Combined with the power of [**`uWebsockets.js`**](https://github.com/uNetworking/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.
## Installation
```sh
npm i @nnmt/platform-hyper-express
```
## Usage
Use **HyperExpressAdapter** for NestJS HTTP Adapter. Must require **`@nestjs/platform-express`** in dependencies.
```js
// 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).
```js
// 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(
AppModule,
new HyperExpressAdapter(),
);
await app.listen(3000);
}
bootstrap();
```
## Sample
- Sample projects are located in **`/sample`** directory.
- Sample projects help developers to install/integrate **`platform-hyper-express`** into their NestJS projects.
- Sample projects is not included in NPM package's source.
## Encountering Problems?
- **`@nnmt/platform-hyper-express`** is mostly compatible with **`@nestjs/platform-express`** but 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 1`**](https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list) platforms.
- The uWebsockets.js version header is disabled by default. You may opt-out of this behavior by setting an environment variable called **`KEEP_UWS_HEADER`** to a truthy value such as **`1`** or **`true`**.
## Still Having Problems?
- Open an [**`Issue`**](https://github.com/cpfriend1721994/platform-hyper-express/issues) with details about what led up to the problem including error traces, route information, etc.
## Testing Changes
To run platform-hyper-express functionality tests locally on your machine, you must follow the steps below.
1. Clone the [**`platform-hyper-express`**](https://github.com/cpfriend1721994/platform-hyper-express.git) repository to your machine.
2. Initialize and pull any submodule(s) which are used throughout the tests.
3. Run **`npm install`** in the root directory.
4. Run **`npm install`** in the **`/tests`** directory.
5. Run **`npm test`** to run all tests with your local changes.
## License
[**MIT**](./LICENSE)