This repository was archived by the owner on Jun 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-23
lines changed Expand file tree Collapse file tree 1 file changed +24
-23
lines changed Original file line number Diff line number Diff line change @@ -18,36 +18,37 @@ npm install @netlify/functions
18
18
19
19
To use On-demand Builders, wrap your function handler with the ` builder ` function.
20
20
21
- _ With JavaScript:_
21
+ - With JavaScript:
22
22
23
- ``` js
24
- const { builder } = require (' @netlify/functions' )
23
+ ``` js
24
+ const { builder } = require (' @netlify/functions' )
25
25
26
- const handler = async (event , context ) => {
27
- return {
28
- statusCode: 200 ,
29
- body: JSON .stringify ({ message: ' Hello World' }),
30
- }
31
- }
26
+ const handler = async (event , context ) => {
27
+ return {
28
+ statusCode: 200 ,
29
+ body: JSON .stringify ({ message: ' Hello World' }),
30
+ }
31
+ }
32
32
33
- exports .handler = builder (handler)
34
- ```
33
+ exports .handler = builder (handler)
34
+ ```
35
35
36
- _ With TypeScript:_
37
- ``` ts
38
- import { builder , Handler } from ' @netlify/functions'
36
+ - With TypeScript:
39
37
40
- const myHandler: Handler = async (event , context ) => {
41
- return {
42
- statusCode: 200 ,
43
- body: JSON .stringify ({ message: " Hello World" }),
44
- }
45
- }
38
+ ` ` ` ts
39
+ import { builder, Handler } from '@netlify/functions'
46
40
47
- const handler = builder (myHandler )
41
+ const myHandler: Handler = async (event, context) => {
42
+ return {
43
+ statusCode: 200,
44
+ body: JSON.stringify({ message: "Hello World" }),
45
+ }
46
+ }
48
47
49
- export { handler }
50
- ```
48
+ const handler = builder(myHandler)
49
+
50
+ export { handler }
51
+ ` ` `
51
52
52
53
### TypeScript typings
53
54
You can’t perform that action at this time.
0 commit comments