added to remote repo
This commit is contained in:
1 parent
8697c9f405
commit
cc599b6e18
8049 files changed
+1096323
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { Router } from 'express';
|
||||
import { readEnvSettings, writeEnvSettings } from '../config.js';
|
||||
|
||||
export const settingsRouter = Router();
|
||||
|
||||
settingsRouter.get('/', async (_req, res, next) => {
|
||||
try {
|
||||
res.json({ fields: await readEnvSettings() });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
settingsRouter.put('/', async (req, res, next) => {
|
||||
try {
|
||||
res.json({
|
||||
fields: await writeEnvSettings(req.body?.values || {}),
|
||||
message: 'Settings saved.',
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user