mirror of
https://github.com/ION606/argo-temp.git
synced 2026-05-15 04:16:53 +00:00
17 lines
441 B
JavaScript
17 lines
441 B
JavaScript
const serveFile = (path) => new Response(Bun.file(path));
|
|
|
|
const server = Bun.serve({
|
|
port: Number(process.env.PORT || 8080),
|
|
async fetch(req) {
|
|
const url = new URL(req.url);
|
|
if (url.pathname === '/') return serveFile('./public/index.html');
|
|
if (url.pathname.startsWith('/static/')) {
|
|
return serveFile(`.${url.pathname}`);
|
|
}
|
|
|
|
return serveFile('./public/index.html');
|
|
},
|
|
});
|
|
|
|
console.log(`reef listening on ${server.port};`);
|