Resources.

serve-handler npm package

documentation

Installation

npm install serve-handler

This package represents the core of serve. It can be plugged into any HTTP server and is responsible for routing requests and handling responses.

const handler = require('serve-handler');

module.exports = async (request, response) => {
  await handler(request, response);
};

Options

await handler(request, response, {
 public: './frontend'
});

The above shows how you can serve a subdirectory.