You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,46 @@ This will start the normal create-react-app dev server and open your app at `htt
50
50
51
51
Local in-app requests to the relative path `/.netlify/functions/*` will automatically be proxied to the local functions dev server.
52
52
53
+
<detail>
54
+
<summary>
55
+
<b>Typescript</b>
56
+
</summary>
57
+
You can use Typescript in both your React code (with `react-scripts` v2.1+) and your lambda functions )with `netlify-lambda` v1.1+). Follow these instructions:
msg: `Hello world ${Math.floor(Math.random() *10)}`
76
+
})
77
+
};
78
+
79
+
callback(undefined, response);
80
+
};
81
+
82
+
export { handler };
83
+
84
+
```
85
+
86
+
rerun and see it work!
87
+
88
+
You are free to set up your `tsconfig.json` and `tslint` as you see fit.
89
+
90
+
</detail>
91
+
92
+
53
93
## Service Worker
54
94
55
95
The service worker does not work with lambda functions out of the box. It prevents calling the function and returns the app itself instead ([Read more](https://github.com/facebook/create-react-app/issues/2237#issuecomment-302693219)). To solve this you have to eject and enhance the service worker configuration in the webpack config. Whitelist the path of your lambda function and you are good to go.
0 commit comments