Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit e2d9b23

Browse files
chore: update README
1 parent 7eac34f commit e2d9b23

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
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-
Development utilities for Netlify Functions.
7+
JavaScript/TypeScript utilities for Netlify Functions.
88

99
## Installation
1010

@@ -18,6 +18,8 @@ npm install @netlify/functions
1818

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

21+
_With JavaScript:_
22+
2123
```js
2224
const { builder } = require('@netlify/functions')
2325

@@ -31,6 +33,22 @@ const handler = async (event, context) => {
3133
exports.handler = builder(handler)
3234
```
3335

36+
_With TypeScript:_
37+
```ts
38+
import { builder, Handler } from '@netlify/functions'
39+
40+
const myHandler: Handler = async (event, context) => {
41+
return {
42+
statusCode: 200,
43+
body: JSON.stringify({ message: "Hello World" }),
44+
}
45+
}
46+
47+
const handler = builder(myHandler)
48+
49+
export { handler }
50+
```
51+
3452
### TypeScript typings
3553

3654
This module exports typings for authoring Netlify Functions in TypeScript.

0 commit comments

Comments
 (0)