0.10.1-beta.0 • Published 4 years ago
@sgrove/netlify-functions v0.10.1-beta.0
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.
With JavaScript:
const { builder } = require('@netlify/functions') const handler = async (event, context) => { return { statusCode: 200, body: JSON.stringify({ message: 'Hello World' }), } } exports.handler = builder(handler)
With TypeScript:
import { builder, Handler } from '@netlify/functions' const myHandler: Handler = async (event, context) => { return { statusCode: 200, body: JSON.stringify({ message: 'Hello World' }), } } const handler = builder(myHandler) export { handler }
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:
Handler
HandlerCallback
HandlerContext
HandlerEvent
HandlerResponse
Contributors
Please see CONTRIBUTING.md for instructions on how to set up and work on this repository. Thanks for contributing!
0.10.1-beta.0
4 years ago
0.8.0-4
4 years ago
0.8.0-3
4 years ago
0.8.0-2
4 years ago
0.8.0-1
4 years ago
0.8.0-5
4 years ago
0.7.3-handle-secrets.8
4 years ago
0.7.3-handle-secrets.4
4 years ago
0.7.3-handle-secrets.5
4 years ago
0.7.3-handle-secrets.6
4 years ago
0.7.3-handle-secrets.7
4 years ago
0.7.3-handle-secrets.3
4 years ago
0.7.3-handle-secrets.2
4 years ago
0.7.3-handle-secrets.1
4 years ago