9
0
mirror of https://github.com/Lomanic/presence-button-web synced 2024-11-22 21:47:29 +00:00

🏥🎈 Checkpoint

./server.js:933874/1067
This commit is contained in:
Glitch (hello-express) 2019-11-03 11:33:59 +00:00
parent 752427dec7
commit 7721c072ad

View File

@ -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() {