Changed Dockerfile

This commit is contained in:
Jose Selesan
2026-04-09 10:43:19 -03:00
parent 2a0558347a
commit 063991770a
6 changed files with 57 additions and 121 deletions

View File

@@ -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())
})
}