feat(server): implemented SPA mode, needs tests
This commit is contained in:
parent
4a1d655523
commit
a48ca0616b
@ -1,6 +1,5 @@
|
|||||||
import type { Application } from 'express'
|
import type { Application } from 'express'
|
||||||
import type { ApiHandler } from '../../types'
|
import type { ApiHandler } from '../../types'
|
||||||
|
|
||||||
import getEndpoints from './get'
|
import getEndpoints from './get'
|
||||||
import deleteEndpoints from './delete'
|
import deleteEndpoints from './delete'
|
||||||
import postEndpoints from './post'
|
import postEndpoints from './post'
|
||||||
@ -39,4 +38,9 @@ export function registerApis(app: Application) {
|
|||||||
app[method](prependApiPath(endpoint.path), endpoint.handler)
|
app[method](prependApiPath(endpoint.path), endpoint.handler)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Fallback, for SPA mode
|
||||||
|
app.get('*', (_, res) => {
|
||||||
|
res.redirect('/')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user