feat(server): implemented SPA mode, needs tests

This commit is contained in:
Roberto Tonino 2021-05-13 21:23:48 +02:00
parent 4a1d655523
commit a48ca0616b

View file

@ -1,6 +1,5 @@
import type { Application } from 'express'
import type { ApiHandler } from '../../types'
import getEndpoints from './get'
import deleteEndpoints from './delete'
import postEndpoints from './post'
@ -39,4 +38,9 @@ export function registerApis(app: Application) {
app[method](prependApiPath(endpoint.path), endpoint.handler)
})
})
// Fallback, for SPA mode
app.get('*', (_, res) => {
res.redirect('/')
})
}