Packages

@mjackson/node-fetch-server

0.7.0 · 6 Jun 2025MIT2.4M / weekRepositoryHomepagenpmAtom feed

Your version

0.6.0

6 Feb 2025Where it was published

0.7.0 is the newest release of 0.6.x.

In short

1 new

Release note

  • Add http/2 support

import * as http2 from 'node:http2';
import { createRequestListener } from '@mjackson/node-fetch-server';

let server = http2.createSecureServer(options);

server.on(
  'request',
  createRequestListener((request) => {
    let url = new URL(request.url);

    if (url.pathname === '/') {
      return new Response('Hello HTTP/2!', {
        headers: {
          'Content-Type': 'text/plain'
        },
      });
    }

    return new Response('Not Found', { status: 404 });
  }),
);

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.