File tree 3 files changed +45
-24
lines changed
3 files changed +45
-24
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ const { default : axios } = require ( "axios" )
2
+
3
+ exports . handler = async function ( event , callback ) {
4
+
5
+ const NYT_APP_API_KEY = process . env . REACT_APP_NYT_APP_API_KEY
6
+ const BASE_URL = process . env . REACT_APP_BASE_URL_API_NYT
7
+
8
+ const API_URL = `${ BASE_URL } /lists/overview.json?api-key=${ NYT_APP_API_KEY } `
9
+
10
+ try {
11
+ const response = await axios . get ( API_URL ) ;
12
+ return {
13
+ statusCode : 200 ,
14
+ body : JSON . stringify ( response . data )
15
+ }
16
+ } catch ( error ) {
17
+ return {
18
+ statusCode : 500 ,
19
+ body : JSON . stringify ( error )
20
+ }
21
+ }
22
+
23
+ // const pass = (body) => {callback(null, {statusCode: 200, body: JSON.stringify(body)})}
24
+
25
+ // const NYT_APP_API_KEY = process.env.REACT_APP_NYT_APP_API_KEY
26
+ // const BASE_URL = process.env.REACT_APP_BASE_URL_API_NYT
27
+
28
+ // const API_URL = `${BASE_URL}/lists/overview.json?api-key=${NYT_APP_API_KEY}`
29
+ // try {
30
+ // let response = await fetch(API_URL,
31
+ // {
32
+ // method: event.httpMethod,
33
+ // body: event.body
34
+ // })
35
+ // let data = await response.json()
36
+ // await pass(data)
37
+ // } catch(err) {
38
+ // let error = {
39
+ // statusCode: err.statusCode || 500,
40
+ // body: JSON.stringify({error: err.message})
41
+ // }
42
+ // await pass(error)
43
+ // }
44
+ }
Original file line number Diff line number Diff line change 1
1
[build ]
2
2
Command = " npm run build"
3
- functions = " netlify-lambda "
3
+ functions = " functions/ "
4
4
Publish = " public"
You can’t perform that action at this time.
0 commit comments