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
// This val will respond with an HTML page saying "Hello, world!" with fun CSS styles.
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Pacifico&display=swap');
body {
font-family: 'Press Start 2P', cursive;
background: linear-gradient(135deg, #FF4081 0%, #81D4FA 100%);
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
animation: gradientAnimation 15s ease infinite;
}
h1 {
font-family: 'Pacifico', cursive;
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
animation: textAnimation 5s infinite;
}
@keyframes gradientAnimation {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
@keyframes textAnimation {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.2); }
}
</style>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
`;
// Respond with HTML content
return new Response(htmlContent, {
headers: {
"Content-Type": "text/html",
},
});
}