Skip to content
Snippets Groups Projects
Commit a915fb2d authored by Robin Leber's avatar Robin Leber
Browse files

feat: UI to clean up docker

parent a2207f4d
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ const PORT = 3001; ...@@ -15,7 +15,7 @@ const PORT = 3001;
app.use(cors()); app.use(cors());
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use("/customCode", customCodeRouter); app.use("/customCode", customCodeRouter);
app.use("/deploy", deployRouter); app.use("/deployment", deployRouter);
app.get("/", (req, res) => { app.get("/", (req, res) => {
res.send("Hello World"); res.send("Hello World");
......
...@@ -4,12 +4,13 @@ const { ...@@ -4,12 +4,13 @@ const {
stopArchitecture, stopArchitecture,
restartArchitecture, restartArchitecture,
} = require("../functions/helperFunctions"); } = require("../functions/helperFunctions");
const { dockerCleanUp } = require("../docker/dockerManager");
const deployRouter = express.Router(); const deployRouter = express.Router();
deployRouter.post("/run", async (req, res) => { deployRouter.post("/run", async (req, res) => {
try { try {
deployArchitecture(); await deployArchitecture();
res.status(200).json({ message: "Deployment erfolgreich!" }); res.status(200).json({ message: "Deployment erfolgreich!" });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
...@@ -19,7 +20,7 @@ deployRouter.post("/run", async (req, res) => { ...@@ -19,7 +20,7 @@ deployRouter.post("/run", async (req, res) => {
deployRouter.post("/stop", async (req, res) => { deployRouter.post("/stop", async (req, res) => {
try { try {
stopArchitecture(); await stopArchitecture();
res.status(200).json({ message: "Stop erfolgreich!" }); res.status(200).json({ message: "Stop erfolgreich!" });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
...@@ -29,7 +30,7 @@ deployRouter.post("/stop", async (req, res) => { ...@@ -29,7 +30,7 @@ deployRouter.post("/stop", async (req, res) => {
deployRouter.post("/restart", async (req, res) => { deployRouter.post("/restart", async (req, res) => {
try { try {
restartArchitecture(); await restartArchitecture();
res.status(200).json({ message: "Stop erfolgreich!" }); res.status(200).json({ message: "Stop erfolgreich!" });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
...@@ -37,4 +38,14 @@ deployRouter.post("/restart", async (req, res) => { ...@@ -37,4 +38,14 @@ deployRouter.post("/restart", async (req, res) => {
} }
}); });
deployRouter.get("/clearDocker", async (rey, res) => {
try {
await dockerCleanUp();
res.status(200).json({ message: "Docker leeren erfoglreich" });
} catch (e) {
console.error(e);
res.status(500).json({ message: "Docker leeren fehlgeschlagen" });
}
});
module.exports = deployRouter; module.exports = deployRouter;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment