Interface: ExpressMiddleware<PluginConfig, Storage, Auth>
This function allow add additional middleware to the application.
ts
import express, { Request, Response } from 'express';
class Middleware extends Plugin {
// instances of auth and storage are injected
register_middlewares(app, auth, storage) {
const router = express.Router();
router.post('/my-endpoint', (req: Request, res: Response): void => {
res.status(200).end();
});
}
}
const [plugin] = await asyncLoadPlugin(...);
plugin.register_middlewares(app, auth, storage);Extends
Plugin<PluginConfig>
Type Parameters
| Type Parameter |
|---|
PluginConfig |
Storage |
Auth |
Properties
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
config | readonly | unknown | Alpha | Plugin.config |
options | readonly | PluginOptions | Alpha | Plugin.options |
version | readonly | number | Alpha | Plugin.version |
Methods
getVersion()
ts
getVersion(): number;Alpha
Returns
number
Inherited from
register_middlewares()
ts
register_middlewares(
app,
auth,
storage): void;Parameters
| Parameter | Type |
|---|---|
app | Express |
auth | Auth |
storage | Storage |
Returns
void