fix: sempre problemi con BASE_URL

pull/11/head
Antonio De Lucreziis 11 months ago
parent 3b2ea91e85
commit 3a080f0ddd

@ -1,3 +1,3 @@
BASE_URL=/
BASE_URL=/problemi/
DATABASE_PATH=db.local.json

@ -30,7 +30,7 @@ import { UserPage } from './pages/UserPage'
export const App = ({ url }: { url?: string }) => {
// during server side rendering don't prepend the BASE_URL
const pbu = useContext(ServerContext) ? (s: string) => s : prependBaseUrl
const pbu = prependBaseUrl
const handleRouteChange = () => {
// @ts-ignore

@ -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, () => {

Loading…
Cancel
Save