The Endpoint Function

Napkin includes its own Node.js 14.x runtime with additional features for handling HTTP traffic. To get access to incoming request data and outgoing response data, simply export a default function with 2 parameters like this:

export default (req, res) => {
  // any logic here
};

The function should have 2 parameters: req and res . For instance, you can access the incoming request parameters via the req.params function and send back content in the response via res.send. These objects are very similar to the Express' request and response APIs: https://expressjs.com/en/api.html#req