Skip to content

@verdaccio/core


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

Type Parameters

Type Parameter
PluginConfig
Storage
Auth

Properties

PropertyModifierTypeDescriptionInherited from
configreadonlyunknownAlphaPlugin.config
optionsreadonlyPluginOptionsAlphaPlugin.options
versionreadonlynumberAlphaPlugin.version

Methods

getVersion()

ts
getVersion(): number;

Alpha

Returns

number

Inherited from

Plugin.getVersion


register_middlewares()

ts
register_middlewares(
   app, 
   auth, 
   storage): void;

Parameters

ParameterType
appExpress
authAuth
storageStorage

Returns

void

Released under the MIT License.