monkeytype/backend/middlewares/context.js
Bruce Berrios 957b4cf1a8
Endpoint schemas/Improved Auth Middleware (#2411) by Bruception
* Lots of stuff

* Changed code order

* Change message

* Use strict comparison

* Fix Bearer auth

* changed failed validation message

* removed full stops

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-02-04 21:18:22 +01:00

16 lines
320 B
JavaScript

const ConfigurationDAO = require("../dao/configuration");
async function contextMiddleware(req, res, next) {
const configuration = await ConfigurationDAO.getCachedConfiguration(true);
req.ctx = {
configuration,
decodedToken: {
uid: null,
},
};
next();
}
module.exports = contextMiddleware;