-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
22 lines (20 loc) · 766 Bytes
/
Copy pathserver.js
File metadata and controls
22 lines (20 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const server = Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);
const path = url.pathname === '/' ? '/index.html' : url.pathname;
const file = Bun.file('.' + path);
if (!await file.exists()) return new Response('Not found', { status: 404 });
return new Response(file);
}
});
console.log(`
\x1b[32m
,---.| | |
|---|| ,---.,---.|---.,---.,---.,---.,---.,---.,---|,---.
| || | ||---'| || ,---|| | || || |,---|
\` '\`---'\`---|'---'\`---'\` \`---^\`---'\`---'\` '\`---'\`---^
\`---' \x1b[0m
\x1b[32m Slither · Solve · Survive\x1b[0m
\x1b[2mhttp://localhost:${server.port}\x1b[0m
`);