diff --git a/index.js b/app.js old mode 100755 new mode 100644 similarity index 71% rename from index.js rename to app.js index a1d3964..b866e3a --- a/index.js +++ b/app.js @@ -2,6 +2,7 @@ const axios = require('axios'); const express = require('express') const app = express() const port = 3000 +const path = require('path'); async function resetvm(vmid){ try { @@ -18,7 +19,14 @@ async function resetvm(vmid){ } } -app.get('/:id', async (req, res) => { + +app.use('/static', express.static(path.join(__dirname, 'static'))); + +app.get('/', function(req, res) { + res.sendFile(path.join(__dirname, '/static/index.html')); +}); + +app.post('/:id', async (req, res) => { let apiCall = await resetvm(req.params.id) if(apiCall){ res.send(`the vm ${req.params.id} has been reset`) @@ -28,5 +36,5 @@ app.get('/:id', async (req, res) => { }) app.listen(port, () => { - console.log(`Example app listening on port ${port}`) + console.log(`App listening on port ${port}`) }) \ No newline at end of file diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..2086e3f --- /dev/null +++ b/static/index.html @@ -0,0 +1,17 @@ + + + +