Files
talk/routes/api/settings/index.js
T
Wyatt Johnson 745c579b82 Adjust redis to not start during webpack build
- Added new WEBPACK env var which is enabled during yarn build scripts
- Defered redis starting until listen is called
- Moved pubsub to a factory pattern init
- Async/Await'ed the routes
- Moved pubsub handle for routes into middleware
- Adjusted redis cache and job processors to have lazy connection
starting
- Disabled mongo from auto-connecting on require
- Adjusted package redis clients to act as factory singletons instead
2017-07-17 13:34:04 -06:00

25 lines
501 B
JavaScript

const express = require('express');
const SettingsService = require('../../../services/settings');
const router = express.Router();
router.get('/', async (req, res, next) => {
try {
let settings = await SettingsService.retrieve();
res.json(settings);
} catch (e) {
return next(e);
}
});
router.put('/', async (req, res, next) => {
try {
await SettingsService.update(req.body);
res.status(204).end();
} catch (e) {
return next(e);
}
});
module.exports = router;