-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.ts
More file actions
54 lines (48 loc) · 1.3 KB
/
server.ts
File metadata and controls
54 lines (48 loc) · 1.3 KB
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
const PORT = 2121
const server = Bun.serve({
port: PORT,
fetch: async (request) => {
const url = new URL(request.url);
const path = url.pathname;
if (path === "/") {
const html = await Bun.file('index.html').text();
return new Response(html, {
status: 200,
headers: {
'Content-Type': 'text/html'
}
})
}
const js = await Bun.file("build/index.js")
.text();
return new Response(
js,
{
status: 200,
statusText: "loaded js successfully ✪ ω ✪",
headers: {
'Content-Type': 'application/javascript'
}
}
)
}
})
const kaomojis = [
"(¬‿¬)",
"(◕‿◕)",
"(✿◠‿◠)",
"(╯°□°)╯︵ ┻━┻",
"(ง'̀-'́)ง",
"(。♥‿♥。)",
"(≧◡≦)",
"(⊙_☉)",
"(◕‿-)",
"✪ ω ✪",
"(* ̄0 ̄)ノ",
"༼ つ ◕_◕ ༽つ",
"ヽ(°〇°)ノ",
"(⓿_⓿)",
];
const randomKaomoji = kaomojis[Math.floor(Math.random() * kaomojis.length)];
console.log(`Server running on port ${PORT} ...${randomKaomoji}`)
console.log(`http://localhost:${PORT}`)