monkeytype/backend/middlewares/context.js
Bruce Berrios 101c227599
Add Dynamic Server Configuration (#2385) by Bruception
* Add no frontend script

* Define context middleware

* Define base configuration schema

* Define configuration DAO

* Setup context middleware and live configuration fetch

* Remove patch configuration method

* Rename files for consistency

* Use plain object check

* Use plain object

* modified base configuration

* renamed config property

* brought back 2 properties

Co-authored-by: Miodec <bartnikjack@gmail.com>
2022-01-31 22:47:58 +01:00

14 lines
280 B
JavaScript

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