spdy-nest
v0.0.9
Published
A wrapper for using HTTP2 in Nest JS
Downloads
361
Readme
Description
Installation
$ npm install spdy-nest
Usage
Implementation is almost identical to the documentation on using HTTPS in Nest.
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { AppModule } from './app.module';
const spdyNest = require('spdy-nest');
const cors = require('cors');
const express = require('express');
const server = express();
// paths to certificates
const httpsOptions = {
key: './secrets/private-key.pem',
cert: './secrets/public-certificate.pem',
};
async function bootstrap() {
// enable cors
server.use(cors());
const app = await NestFactory.create(AppModule, new ExpressAdapter(server));
await app.listen(3000);
await spdyNest(httpsOptions, server, 443);
}
bootstrap();