netlify / functions

JavaScript and TypeScript utilities for Netlify Functions.
https://www.npmjs.com/package/@netlify/functions
MIT License
41 stars 17 forks source link
aws functions javascript lambda-functions netlify netlify-functions netlify-lambda netlify-lambda-functions nodejs serverless typescript

functions

Build Node

JavaScript and TypeScript utilities for Netlify Functions.

Installation

npm install @netlify/functions

Usage

On-demand Builders

To use On-demand Builders, wrap your function handler with the builder function.

Scheduled Functions (currently in beta)

To use Scheduled Functions, wrap your function handler with the schedule function.

TypeScript typings

This module exports typings for authoring Netlify Functions in TypeScript.

import { Handler } from '@netlify/functions'

const handler: Handler = async (event, context) => {
  return {
    statusCode: 200,
    body: JSON.stringify({ message: 'Hello World' }),
  }
}

export { handler }

The following types are exported:

Contributors

Please see CONTRIBUTING.md for instructions on how to set up and work on this repository. Thanks for contributing!