1 | ;
|
2 |
|
3 | const AppError = require('./appError');
|
4 | const prometheusMiddlewares = require('./models/prometheus/prometheusMiddlewares');
|
5 |
|
6 |
|
7 | const middlewares = {
|
8 | getRouterAuthorizationMiddleware (routerToken) {
|
9 | return (ctx, next) => {
|
10 | if (ctx.headers.authorization !== routerToken) {
|
11 | throw AppError.unauthorized();
|
12 | }
|
13 | return next();
|
14 | };
|
15 | },
|
16 | ...prometheusMiddlewares
|
17 | };
|
18 |
|
19 | module.exports = middlewares;
|