npm.io
8.1.1 • Published 1 week ago

@verdaccio/middleware

Licence
MIT
Version
8.1.1
Deps
8
Size
224 kB
Vulns
0
Weekly
0
Stars
17.8K

@verdaccio/middleware - Verdaccio Express Middleware

Verdaccio Home MIT License Verdaccio Latest This Package Latest

Documentation Discord Bluesky Backers Sponsors

Verdaccio Downloads Docker Pulls GitHub Stars

Note: This package is mostly for internal use by Verdaccio and is only intended to be used with Verdaccio 6.x.

Overview

The @verdaccio/middleware package provides Express middleware functions for the Verdaccio registry server. It includes request validation, logging, error handling, rate limiting, security headers, and web UI rendering.

Installation

npm install @verdaccio/middleware

Usage

import {
  allow,
  antiLoop,
  encodeScopePackage,
  errorReportingMiddleware,
  expectJson,
  handleError,
  log,
  match,
  media,
  rateLimit,
  registerBodyParser,
  validateName,
  validatePackage,
  webMiddleware,
} from '@verdaccio/middleware';
API
Validation & Processing
  • validateName - Validates package names in route parameters
  • validatePackage - Validates package identifiers
  • media - Content-type media handler
  • expectJson - Ensures request content-type is JSON
  • encodeScopePackage - Encodes scoped package names
Request Control
  • match(regexp) - Route matching middleware
  • antiLoop - Prevents circular proxy requests
  • allow - Authorization middleware
  • rateLimit - Rate limiting middleware
  • registerBodyParser(app) - Registers JSON body parser
Web UI
  • webMiddleware() - Web UI Express middleware
  • setSecurityWebHeaders(res) - Sets security headers for the web UI
Logging & Error Handling
  • log() - Request logging middleware
  • errorReportingMiddleware(logger) - Error reporting middleware
  • handleError(err, req, res, next) - Error handler

Donations

Verdaccio is run by volunteers; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - your logo might end up in this readme.

Donate starting from $1/month or just one single contribution.

Report a vulnerability

If you want to report a security vulnerability, please follow the steps which we have defined for you in our security policy.

Open Collective Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

sponsor sponsor sponsor sponsor sponsor sponsor sponsor sponsor sponsor sponsor

Open Collective Backers

Thank you to all our backers! [Become a backer]

backers

Special Thanks

Thanks to the following companies to help us to achieve our goals providing free open source licenses.

jetbrains crowdin

Contributors

This project exists thanks to all the people who contribute. [Contribute].

contributors

FAQ / Contact / Troubleshoot

If you have any issue you can try the following options. Do not hesitate to ask or check our issues database. Perhaps someone has asked already what you are looking for.

License

Verdaccio is MIT licensed

The Verdaccio documentation and logos (excluding /thanks, e.g., .md, .png, .sketch files within the /assets folder) are Creative Commons licensed.

Keywords