Interface: ExpressMiddleware<PluginConfig, Storage, Auth>
pluginUtils.ExpressMiddleware
Middleware Plugin Interface
https://verdaccio.org/docs/next/plugin-middleware
This function allow add middleware to the application.
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);
Type parameters
Name |
---|
PluginConfig |
Storage |
Auth |
Hierarchy
Plugin
<PluginConfig
>↳
ExpressMiddleware
Properties
config
• Readonly
config: unknown
Inherited from
Defined in
options
• Readonly
options: PluginOptions
Inherited from
Defined in
version
• Readonly
version: number
Inherited from
Defined in
Methods
getVersion
▸ getVersion(): number
Returns
number
Inherited from
Defined in
register_middlewares
▸ register_middlewares(app
, auth
, storage
): void
Parameters
Name | Type |
---|---|
app | Express |
auth | Auth |
storage | Storage |
Returns
void