mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-23 01:32:58 +01:00
21 lines
495 B
TypeScript
21 lines
495 B
TypeScript
|
import { config } from "dotenv";
|
||
|
import express from "express";
|
||
|
import { saveBackupConfig, validateBackupConfig } from "../services/configService.js";
|
||
|
|
||
|
const configRouter = express.Router();
|
||
|
|
||
|
configRouter.put("/backup", (req, res, next) => {
|
||
|
validateBackupConfig(req.body)
|
||
|
.then(() => {
|
||
|
saveBackupConfig(req.body);
|
||
|
res.status(204);
|
||
|
res.send();
|
||
|
})
|
||
|
.catch((error) => {
|
||
|
res.status(400);
|
||
|
res.json(error.details);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
export default configRouter;
|