fix(xo-server/RestApi): don't fail on missing express
Which is the case when instanciated from `xo-server-recover-account`.
This commit is contained in:
@@ -49,6 +49,13 @@ const subRouter = (app, path) => {
|
||||
|
||||
export default class RestApi {
|
||||
constructor(app, { express }) {
|
||||
// don't setup the API if express is not present
|
||||
//
|
||||
// that can happen when the app is instanciated in another context like xo-server-recover-account
|
||||
if (express === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
const api = subRouter(express, '/rest/v0')
|
||||
|
||||
api.use(({ cookies }, res, next) => {
|
||||
|
||||
Reference in New Issue
Block a user