Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 35618c3

Browse files
author
sw-yx
committed
convert nodefetch ts
1 parent 15f51a9 commit 35618c3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/functions-templates/ts/node-fetch/node-fetch.js renamed to src/functions-templates/ts/node-fetch/node-fetch.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
const fetch = require('node-fetch')
2-
exports.handler = async function(event, context) {
1+
// example of async handler using async-await
2+
// https://github.com/netlify/netlify-lambda/issues/43#issuecomment-444618311
3+
4+
import fetch from 'node-fetch'
5+
import { Context } from 'aws-lambda'
6+
export async function handler(event: any, context: Context) {
37
try {
48
const response = await fetch('https://api.chucknorris.io/jokes/random')
59
if (!response.ok) {

0 commit comments

Comments
 (0)