fix: add static file routes for OG image and favicons
This commit is contained in:
35
src/index.ts
35
src/index.ts
@@ -425,6 +425,41 @@ app.get('/app.js', async (c) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/og-image.png', async (c) => {
|
||||
const file = Bun.file('./src/frontend/og-image.png');
|
||||
return new Response(file, {
|
||||
headers: { 'Content-Type': 'image/png' }
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/favicon.svg', async (c) => {
|
||||
const file = Bun.file('./src/frontend/favicon.svg');
|
||||
return new Response(file, {
|
||||
headers: { 'Content-Type': 'image/svg+xml' }
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/favicon.ico', async (c) => {
|
||||
const file = Bun.file('./src/frontend/favicon.ico');
|
||||
return new Response(file, {
|
||||
headers: { 'Content-Type': 'image/x-icon' }
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/favicon.png', async (c) => {
|
||||
const file = Bun.file('./src/frontend/favicon.png');
|
||||
return new Response(file, {
|
||||
headers: { 'Content-Type': 'image/png' }
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/apple-touch-icon.png', async (c) => {
|
||||
const file = Bun.file('./src/frontend/apple-touch-icon.png');
|
||||
return new Response(file, {
|
||||
headers: { 'Content-Type': 'image/png' }
|
||||
});
|
||||
});
|
||||
|
||||
// Serve index.html for all other routes (SPA fallback)
|
||||
app.get('/', async (c) => {
|
||||
const file = Bun.file('./src/frontend/index.html');
|
||||
|
||||
Reference in New Issue
Block a user