diff --git a/.gitignore b/.gitignore index 123ae94..4d0f726 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,4 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules +/node_modules +npm-debug.log +.DS_Store +/*.env diff --git a/js/main.js b/js/main.js index 5e019a7..9e9aa05 100644 --- a/js/main.js +++ b/js/main.js @@ -3,14 +3,14 @@ if ("serviceWorker" in navigator) { navigator.serviceWorker .register("./serviceWorker.js") //Point to serviceWorker file .then(function (registration) { - console.log("Service Worker is registered"); + console.log("Service Worker is registered", registration); document.getElementById("sw-register-state").textContent = "✓"; //To check support for push notifications isPushNotification(registration); }) .catch(function (error) { - console.error("Failed to register service worker"); + console.error("Failed to register service worker", error); document.getElementById("sw-register-state").textContent = "✕"; //Failed to register }); } @@ -131,7 +131,7 @@ function sendPushNotification(subscription) { .then(function (subscription) { curlCommand(subscription); //To log curl command in console - fetch("http://127.0.0.1:3000/send_notification", { + fetch("/send_notification", { method: "post", headers: { "Accept": "application/json", diff --git a/package.json b/package.json index f39a470..a376ade 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,19 @@ { "name": "demo", "description": "Demo - progress web application", - "version": "0.0.1", + "version": "1.0.0", + "author": "gokulkrishh", "dependencies": { "body-parser": "^1.15.0", "express": "^4.13.4", "node-gcm": "^0.14.0" }, + "engines": { + "node": "4.1.1" + }, "devDependencies": {}, "scripts": { "start": "node server.js" - } + }, + "license": "MIT" } diff --git a/server.js b/server.js index 1725bb4..25c691f 100644 --- a/server.js +++ b/server.js @@ -47,6 +47,6 @@ app.post("/send_notification", function (req, res) { }); }); -app.listen(3000, function() { +app.listen(process.env.PORT || 3000, function() { console.log("Local Server : http://localhost:3000"); });