Mount plugins before bodyParser
Otherwise it consumes the body and plugins won't be able to do things like proxy POST requests.
This commit is contained in:
parent
c78f56b334
commit
2fe3d57df3
@ -114,6 +114,11 @@ export const register = async (
|
||||
})
|
||||
})
|
||||
|
||||
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
|
||||
const papi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
|
||||
await papi.loadPlugins()
|
||||
papi.mount(app, wsApp)
|
||||
|
||||
app.use(bodyParser.json())
|
||||
app.use(bodyParser.urlencoded({ extended: true }))
|
||||
|
||||
@ -136,10 +141,6 @@ export const register = async (
|
||||
app.use("/static", _static.router)
|
||||
app.use("/update", update.router)
|
||||
|
||||
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
|
||||
const papi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
|
||||
await papi.loadPlugins()
|
||||
papi.mount(app, wsApp)
|
||||
app.use("/api/applications", apps.router(papi))
|
||||
wrapper.onDispose(() => papi.dispose())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user