@netlify/functions-runtime-api
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Build Node

Netlify Functions runtime 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' })
}

Development

These are two main artifacts produced by this project:

  1. npm module: The API and the Lambda interoperability layer are published as an npm module. To generate the module, run npm run compile.
  2. Lambda Layer: The runtime API is injected into user code using Lambda Layers. To generate the layer ZIP archive, run npm run build.

Readme

Keywords

none

Package Sidebar

Install

npm i @netlify/functions-runtime-api

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

63.4 kB

Total Files

39

Last publish

Collaborators

  • youvalv
  • berdav
  • vitaliyr
  • smnh
  • denar90
  • kathmbeck
  • rj-netlify
  • akardet
  • pieh
  • hrishikeshk
  • sarahetter
  • orinokai
  • ericap
  • seanroberts
  • skn0tt
  • mikewen
  • biilmann
  • marcus.netlify
  • jgantunes
  • eduardoboucas
  • netlify-bot
  • nasiba
  • ascorbic