Skip to content

Commit 17ebd6f

Browse files
chore: update README (#46)
1 parent 703219a commit 17ebd6f

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

README.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Coverage Status](https://codecov.io/gh/netlify/functions-js/branch/main/graph/badge.svg)](https://codecov.io/gh/netlify/functions-js)
55
[![Node](https://img.shields.io/node/v/@netlify/functions.svg?logo=node.js)](https://www.npmjs.com/package/@netlify/functions)
66

7-
JavaScript utilities for Netlify Functions.
7+
Development utilities for Netlify Functions.
88

99
## Installation
1010

@@ -14,10 +14,12 @@ npm install @netlify/functions
1414

1515
## Usage
1616

17-
### Builder Functions
17+
### On-demand Builders
18+
19+
To use On-demand Builders, wrap your function handler with the `builder` function.
1820

1921
```js
20-
const { builderFunction } = require('@netlify/functions')
22+
const { builder } = require('@netlify/functions')
2123

2224
const handler = async (event, context) => {
2325
return {
@@ -26,9 +28,34 @@ const handler = async (event, context) => {
2628
}
2729
}
2830

29-
exports.handler = builderFunction(handler)
31+
exports.handler = builder(handler)
3032
```
3133

34+
### TypeScript typings
35+
36+
This module exports typings for authoring Netlify Functions in TypeScript.
37+
38+
```ts
39+
import { Handler } from '@netlify/functions'
40+
41+
const handler: Handler = async (event, context) => {
42+
return {
43+
statusCode: 200,
44+
body: JSON.stringify({ message: "Hello World" })
45+
}
46+
}
47+
48+
export { handler }
49+
```
50+
51+
The following types are exported:
52+
53+
- `Handler`
54+
- `HandlerCallback`
55+
- `HandlerContext`
56+
- `HandlerEvent`
57+
- `HandlerResponse`
58+
3259
## Contributors
3360

3461
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to set up and work on this repository. Thanks

0 commit comments

Comments
 (0)