Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

spdy-nest

vmcodes344MIT0.0.9TypeScript support: included

A wrapper for using HTTP2 in Nest JS

nest, nest js, http2, https, spdy

readme

Description

A wrapper for SPDY Server intended to make creating HTTP2 servers a little easier in Nest JS.

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();