+ const body: InstallOrUpdatePlugin = req.body
+
+ const fromDisk = !!body.path
+ const toInstall = body.npmName || body.path
+ try {
+ const plugin = await PluginManager.Instance.install(toInstall, undefined, fromDisk)
+
+ return res.json(plugin.toFormattedJSON())
+ } catch (err) {
+ logger.warn('Cannot install plugin %s.', toInstall, { err })
+ return res.sendStatus(HttpStatusCode.BAD_REQUEST_400)
+ }
+}
+
+async function updatePlugin (req: express.Request, res: express.Response) {
+ const body: InstallOrUpdatePlugin = req.body