You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/server/admin/app/server/router/config.ts

39 lines
676 B
TypeScript

/**
* Network 相关接口
*/
import { Router } from 'express';
import { broker } from '../broker';
import { auth } from '../middleware/auth';
const router = Router();
router.get('/client', auth(), async (req, res, next) => {
try {
const config = await broker.call('config.client');
res.json({
config,
});
} catch (err) {
next(err);
}
});
router.patch('/client', auth(), async (req, res, next) => {
try {
await broker.call('config.setClientConfig', {
key: req.body.key,
value: req.body.value,
});
res.json({
success: true,
});
} catch (err) {
next(err);
}
});
export { router as configRouter };