spdy-nest
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

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

Package Sidebar

Install

npm i spdy-nest

Weekly Downloads

105

Version

0.0.8

License

MIT

Unpacked Size

22.1 kB

Total Files

12

Last publish

Collaborators

  • vmcodes