Oh hi,
-Tell me your hopes and dreams:
- - +See documentation for this project on Fuz wiki:
diff --git a/package.json b/package.json index 7254809..e632da4 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,7 @@ { - "//1": "describes your app and its dependencies", - "//2": "https://docs.npmjs.com/files/package.json", - "//3": "updating this file will download and update your packages", - "name": "hello-express", + "name": "presence-button", "version": "0.0.1", - "description": "A simple Node app built on Express, instantly up and running.", + "description": "Always-up server for Fuz presence button", "main": "server.js", "scripts": { "start": "node server.js" @@ -16,12 +13,11 @@ "node": "8.x" }, "repository": { - "url": "https://glitch.com/edit/#!/hello-express" + "url": "https://glitch.com/edit/#!/presence-button" }, "license": "MIT", "keywords": [ "node", - "glitch", "express" ] } diff --git a/public/client.js b/public/client.js deleted file mode 100644 index 3b00a1e..0000000 --- a/public/client.js +++ /dev/null @@ -1,42 +0,0 @@ -// client-side js -// run by the browser each time your view template is loaded - -console.log("hello world :o"); - -// our default array of dreams -const dreams = [ - "Find and count some sheep", - "Climb a really tall mountain", - "Wash the dishes" -]; - -// define variables that reference elements on our page -const dreamsList = document.getElementById("dreams"); -const dreamsForm = document.forms[0]; -const dreamInput = dreamsForm.elements["dream"]; - -// a helper function that creates a list item for a given dream -const appendNewDream = function(dream) { - const newListItem = document.createElement("li"); - newListItem.innerHTML = dream; - dreamsList.appendChild(newListItem); -}; - -// iterate through every dream and add it to our page -dreams.forEach(function(dream) { - appendNewDream(dream); -}); - -// listen for the form to be submitted and add a new dream when it is -dreamsForm.onsubmit = function(event) { - // stop our form submission from refreshing the page - event.preventDefault(); - - // get dream value and add it to the list - dreams.push(dreamInput.value); - appendNewDream(dreamInput.value); - - // reset form - dreamInput.value = ""; - dreamInput.focus(); -}; diff --git a/server.js b/server.js index 55cac78..5b3e51e 100644 --- a/server.js +++ b/server.js @@ -1,13 +1,6 @@ -// server.js -// where your node app starts - -// init project const express = require("express"); const app = express(); -// we've started you off with Express, -// but feel free to use whatever libs or frameworks you'd like through `package.json`. - // http://expressjs.com/en/starter/static-files.html app.use(express.static("public")); @@ -16,7 +9,16 @@ app.get("/", function(request, response) { response.sendFile(__dirname + "/views/index.html"); }); -// listen for requests :) +// http://expressjs.com/en/starter/basic-routing.html +app.get("/img", function(request, response) { + response.sendFile(__dirname + "/views/index.html"); +}); + const listener = app.listen(process.env.PORT, function() { console.log("Your app is listening on port " + listener.address().port); }); + +process.on("SIGTERM", function () { + console.log("SIGTERM received, sending SOS to Resurrect..."); + require('https').get("https://resurrect.glitch.me/"+process.env.PROJECT_DOMAIN+"", process.exit) +}); \ No newline at end of file diff --git a/views/index.html b/views/index.html index 6489186..46c5f52 100644 --- a/views/index.html +++ b/views/index.html @@ -10,38 +10,32 @@
-Oh hi,
-Tell me your hopes and dreams:
- - +See documentation for this project on Fuz wiki: