0.10.1-beta.0 • Published 2 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
2 years ago
0.8.0-4
2 years ago
0.8.0-3
2 years ago
0.8.0-2
2 years ago
0.8.0-1
2 years ago
0.8.0-5
2 years ago
0.7.3-handle-secrets.8
3 years ago
0.7.3-handle-secrets.4
3 years ago
0.7.3-handle-secrets.5
3 years ago
0.7.3-handle-secrets.6
3 years ago
0.7.3-handle-secrets.7
3 years ago
0.7.3-handle-secrets.3
3 years ago
0.7.3-handle-secrets.2
3 years ago
0.7.3-handle-secrets.1
3 years ago