-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.func.tsx
43 lines (40 loc) · 1.01 KB
/
index.func.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { useFunc } from '@faasjs/func'
import { useHttp } from '@faasjs/http'
import { renderToString } from 'react-dom/server'
function App() {
return (
<html lang='en'>
<head>
<title>Hi, 🚀 FaasJS is here!</title>
</head>
<body
style={{
padding: '20px',
textAlign: 'center',
maxWidth: '600px',
margin: '0 auto',
}}
>
<h1>Hi, 🚀 FaasJS is here!</h1>
<p>
You can edit current page in{' '}
<code style={{ fontWeight: 'bold' }}>index.func.tsx</code>.
</p>
<p>Or you can explore examples:</p>
<p>
<a href='/examples/todo'>Todo demo</a> based on Ant Design and RsBuild.
</p>
<p>
<a href='/examples/download'>File download demo</a>.
</p>
</body>
</html>
)
}
export default useFunc(() => {
const http = useHttp()
return async () => {
http.setContentType('html')
http.setBody(renderToString(<App />))
}
})