hassio-nextcloud-backup/nextcloud_backup/backend/src/routes/config.ts

21 lines
495 B
TypeScript
Raw Normal View History

2022-09-29 00:05:53 +02:00
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;