@verdaccio/web
Version:
web ui middleware
36 lines (35 loc) • 1.52 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _express = require("express");
var _middleware = require("@verdaccio/middleware");
var _webUtils = require("../web-utils");
var _package = _interopRequireDefault(require("./package"));
var _readme = _interopRequireDefault(require("./readme"));
var _search = _interopRequireDefault(require("./search"));
var _sidebar = _interopRequireDefault(require("./sidebar"));
var _user = _interopRequireDefault(require("./user"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (auth, storage, config) => {
var _config$web;
const route = (0, _express.Router)(); /* eslint new-cap: 0 */
route.use('/data/', (0, _middleware.rateLimit)({
windowMs: 2 * 60 * 1000,
// 2 minutes
max: 5000,
// limit each IP to 1000 requests per windowMs
...(config === null || config === void 0 ? void 0 : (_config$web = config.web) === null || _config$web === void 0 ? void 0 : _config$web.rateLimit)
}));
route.use('/data/', (0, _package.default)(storage, auth, config));
route.use('/data/', (0, _search.default)(storage, auth));
route.use('/data/', (0, _sidebar.default)(config, storage, auth));
route.use('/data/', (0, _readme.default)(storage, auth));
if ((0, _webUtils.hasLogin)(config)) {
route.use('/sec/', (0, _user.default)(auth, config));
}
return route;
};
exports.default = _default;
//# sourceMappingURL=index.js.map