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

🕵 Checkpoint

./server.js:933874/5595
This commit is contained in:
Glitch (hello-express) 2019-11-03 11:45:01 +00:00
parent 7721c072ad
commit 840560b793

View File

@ -1,4 +1,13 @@
var fuzIsOpen = false; var fuzIsOpen = false;
var lastSeen = new Date("1970-01-01");
const fs = require("fs");
const db = "./.data/data.json";
try {
var content = fs.readFileSync(db, "utf8");
fuzIsOpen = JSON.parse(content)[""]
} catch (err) {}
const express = require("express"); const express = require("express");
const app = express(); const app = express();
@ -14,6 +23,8 @@ app.get("/", (req, res) => {
// http://expressjs.com/en/starter/basic-routing.html // http://expressjs.com/en/starter/basic-routing.html
app.get("/img", (req, res) => { app.get("/img", (req, res) => {
res.sendFile(__dirname + "/views/index.html"); res.sendFile(__dirname + "/views/index.html");
if (fuzIsOpen) {
}
}); });
// http://expressjs.com/en/starter/basic-routing.html // http://expressjs.com/en/starter/basic-routing.html
@ -31,7 +42,10 @@ const listener = app.listen(process.env.PORT, function() {
console.log("Your app is listening on port " + listener.address().port); console.log("Your app is listening on port " + listener.address().port);
}); });
process.on("SIGTERM", function () { process.on("SIGTERM", function() {
console.log("SIGTERM received, sending SOS to Resurrect..."); console.log("SIGTERM received, sending SOS to Resurrect...");
require('https').get("https://resurrect.glitch.me/"+process.env.PROJECT_DOMAIN+"", process.exit) require("https").get(
"https://resurrect.glitch.me/" + process.env.PROJECT_DOMAIN + "",
process.exit
);
}); });