chore(project) gitignore, example for debugging, package.json

This commit is contained in:
Benjamin Wegener
2023-11-19 16:14:28 +00:00
parent 683d973857
commit bd4b8a7a59
5 changed files with 87 additions and 0 deletions

17
examples/server.js Normal file
View File

@@ -0,0 +1,17 @@
export default {
port: Bun.env.BUN_PORT || Bun.env.APP_PORT || 3000,
async fetch(req) {
const url = new URL(req.url);
if (url.pathname == '/main.js') {
await Bun.build({
entrypoints: ['./src/main.js'],
outdir: '.',
});
return new Response(Bun.file('./main.js'), {
headers: { 'Cache-Control': 'no-cache' },
});
}
if (url.pathname == '/') return new Response(Bun.file('./index.html'));
return new Response('ERR 404: Not Found', { status: 404 });
},
};