diff --git a/api.js b/api.js index 23321f1..02a6990 100644 --- a/api.js +++ b/api.js @@ -8,7 +8,30 @@ const port = 9999; app.use(cors()).use(express.json()); -app.post('/wake', (req, res) => { +app.get("/", (req, res) => { + let html = ` + + + +

Targets:

+ + `; + res.send(html); +}); + +app.get("/targets", (req, res) => { + res.json(Object.keys(targets)); +}); + +app.post("/wake", (req, res) => { const { mac } = req.body; if(!mac) { @@ -23,7 +46,7 @@ app.post('/wake', (req, res) => { }); }); -app.get('/wake', (req, res) => { +app.get("/wake", (req, res) => { const mac = req.query.mac; if(!mac) { @@ -54,10 +77,6 @@ app.get("/wake/:name", (req, res) => { }); }); -app.get("/targets", (req, res) => { - res.json(Object.keys(targets)); -}); - app.listen(port, () => { console.log('WOL server running on port ' + port); }); \ No newline at end of file