Changed Dockerfile
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { registerApiRoutes } from '@repo/api-contract'
|
||||
import type { Hono } from 'hono'
|
||||
import { serveStatic } from 'hono/bun'
|
||||
import path from 'node:path'
|
||||
import { complexRoutes } from '@/modules/complex/complex.routes'
|
||||
import { courtRoutes } from '@/modules/court/court.routes'
|
||||
import { onboardingRoutes } from '@/modules/onboarding/onboarding.routes'
|
||||
@@ -20,4 +22,23 @@ export function registerRoutes(app: Hono<AppEnv>) {
|
||||
})
|
||||
|
||||
app.route('/api/public-bookings', publicBookingRoutes)
|
||||
|
||||
app.use('*', serveStatic({ root: './public' }))
|
||||
app.get('*', async (c) => {
|
||||
if (c.req.path === '/api' || c.req.path.startsWith('/api/')) {
|
||||
return c.notFound()
|
||||
}
|
||||
|
||||
// Keep real asset URLs as 404s if the file does not exist.
|
||||
if (path.extname(c.req.path)) {
|
||||
return c.notFound()
|
||||
}
|
||||
|
||||
const indexFile = Bun.file('./public/index.html')
|
||||
if (!(await indexFile.exists())) {
|
||||
return c.notFound()
|
||||
}
|
||||
|
||||
return c.html(await indexFile.text())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user