JSPM

  • Created
  • Published
  • Downloads 843449
  • Score
    100M100P100Q203117F
  • License MIT

The runtime API for Netlify Functions

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@netlify/serverless-functions-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Build Node

    Netlify Functions API

    The runtime API for Netlify Functions, compatible with the AWS Lambda runtime API.

    The API

    The API surface is quite minimal: functions are comprised of handlers that receive a Request and return a Response, using the default export.

    export default async (req) => new Response(`Responding to ${req.url}`)

    Functions also receive a context object with a series of convenience properties and methods for easy access to common operations and Netlify features.

    export default async (req, context) => {
      if (req.url === '/move-me') {
        return context.redirect('/other-page')
      }
    
      return context.json({ hello: 'world' })
    }