Initial commit — OFApp client + server
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
21
server/settings.js
Normal file
21
server/settings.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Router } from 'express';
|
||||
import { getAllSettings, setSetting } from './db.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// GET /api/settings
|
||||
router.get('/api/settings', (req, res) => {
|
||||
const settings = getAllSettings();
|
||||
res.json(settings);
|
||||
});
|
||||
|
||||
// PUT /api/settings
|
||||
router.put('/api/settings', (req, res) => {
|
||||
const updates = req.body;
|
||||
for (const [key, value] of Object.entries(updates)) {
|
||||
setSetting(key, String(value));
|
||||
}
|
||||
res.json(getAllSettings());
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user