From 7721c072ade6d972af0ccdeb37edf4934e23126a Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Sun, 3 Nov 2019 11:33:59 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=A5=F0=9F=8E=88=20Checkpoint=20./serve?= =?UTF-8?q?r.js:933874/1067?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 5b3e51e..1656e2e 100644 --- a/server.js +++ b/server.js @@ -1,3 +1,5 @@ +var fuzIsOpen = false; + const express = require("express"); const app = express(); @@ -5,13 +7,24 @@ const app = express(); app.use(express.static("public")); // http://expressjs.com/en/starter/basic-routing.html -app.get("/", function(request, response) { - response.sendFile(__dirname + "/views/index.html"); +app.get("/", (req, res) => { + res.sendFile(__dirname + "/views/index.html"); }); // http://expressjs.com/en/starter/basic-routing.html -app.get("/img", function(request, response) { - response.sendFile(__dirname + "/views/index.html"); +app.get("/img", (req, res) => { + res.sendFile(__dirname + "/views/index.html"); +}); + +// http://expressjs.com/en/starter/basic-routing.html +app.get("/status", (req, res) => { + if (req.query.password !== process.env.PASSWORD) { + return res.sendStatus(401); + } + if (req.query.fuzisopen === "1") { + fuzIsOpen = true; + } + res.sendStatus(200); }); const listener = app.listen(process.env.PORT, function() {