-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
57 lines (49 loc) · 1.33 KB
/
index.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
exports.handler = async function http(req) {
let html = `
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Hi!</title>
<link rel="stylesheet" href="https://static.begin.app/starter/default.css">
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" rel="icon" type="image/x-icon">
</head>
<body>
<h1 class="center-text">
<!-- ↓ Change "Hello world!" to something else and head on back to Begin! -->
Hello world!
</h1>
<p class="center-text">
Your <a href="https://begin.com" class="link" target="_blank">Begin</a> app is ready to go!
</p>
</body>
</html>`
return {
headers: {
'content-type': 'text/html; charset=utf8',
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0'
},
statusCode: 200,
body: html
}
}
// Other example responses
/* Forward requester to a new path
exports.handler = async function http (req) {
return {
statusCode: 302,
headers: {'location': '/about'}
}
}
*/
/* Respond with successful resource creation, CORS enabled
let arc = require('@architect/functions')
exports.handler = arc.http.async (http)
async function http (req) {
return {
statusCode: 201,
json: { ok: true },
cors: true,
}
}
*/