|
|
|
@ -98,8 +98,8 @@ async function createProductionRouter(db: DatabaseConnection) {
|
|
|
|
|
res.send(finalHtml)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.get('/', handleSSR)
|
|
|
|
|
r.use('/', express.static('dist/entry-client'))
|
|
|
|
|
r.get(process.env.BASE_URL ?? '/', handleSSR)
|
|
|
|
|
r.use(process.env.BASE_URL ?? '/', express.static('dist/entry-client'))
|
|
|
|
|
|
|
|
|
|
r.use('*', handleSSR)
|
|
|
|
|
|
|
|
|
@ -113,12 +113,12 @@ async function main() {
|
|
|
|
|
|
|
|
|
|
const [r, db] = await createApiRouter()
|
|
|
|
|
|
|
|
|
|
app.use('/', r)
|
|
|
|
|
app.use(process.env.BASE_URL ?? '/', r)
|
|
|
|
|
|
|
|
|
|
if (config.isDevelopment) {
|
|
|
|
|
app.use('/', await createDevRouter(db))
|
|
|
|
|
app.use(process.env.BASE_URL ?? '/', await createDevRouter(db))
|
|
|
|
|
} else {
|
|
|
|
|
app.use('/', await createProductionRouter(db))
|
|
|
|
|
app.use(process.env.BASE_URL ?? '/', await createProductionRouter(db))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.listen(config.port, () => {
|
|
|
|
|