@netlify/functions
Advanced tools
Comparing version 0.6.0 to 0.7.0
# Changelog | ||
## [0.7.0](https://www.github.com/netlify/functions-js/compare/v0.6.0...v0.7.0) (2021-04-14) | ||
### Features | ||
* add type to builder wrapper ([#48](https://www.github.com/netlify/functions-js/issues/48)) ([0af5b04](https://www.github.com/netlify/functions-js/commit/0af5b04c2b1241f64a56394317371a08781e881d)) | ||
## [0.6.0](https://www.github.com/netlify/functions-js/compare/v0.5.0...v0.6.0) (2021-04-12) | ||
@@ -4,0 +11,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"types": "./src/main.d.ts", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "JavaScript utilities for Netlify Functions", | ||
@@ -8,0 +8,0 @@ "files": [ |
@@ -7,3 +7,3 @@ # @netlify/functions | ||
JavaScript utilities for Netlify Functions. | ||
Development utilities for Netlify Functions. | ||
@@ -18,6 +18,8 @@ ## Installation | ||
### Builder Functions | ||
### On-demand Builders | ||
To use On-demand Builders, wrap your function handler with the `builder` function. | ||
```js | ||
const { builderFunction } = require('@netlify/functions') | ||
const { builder } = require('@netlify/functions') | ||
@@ -31,5 +33,30 @@ const handler = async (event, context) => { | ||
exports.handler = builderFunction(handler) | ||
exports.handler = builder(handler) | ||
``` | ||
### TypeScript typings | ||
This module exports typings for authoring Netlify Functions in TypeScript. | ||
```ts | ||
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 | ||
@@ -36,0 +63,0 @@ |
@@ -0,1 +1,2 @@ | ||
export * from './lib/builder' | ||
export * from './function' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12109
14
128
63