Skip to content

Instantly share code, notes, and snippets.

@svsh227
Created April 26, 2020 18:39
Show Gist options
  • Save svsh227/90d5eb66de33f621d040e454a86ac0d7 to your computer and use it in GitHub Desktop.
Save svsh227/90d5eb66de33f621d040e454a86ac0d7 to your computer and use it in GitHub Desktop.
Show Desktop Notification in Javascript App- Create a Node Server: why we are creating a node server? we have discussed above. Let's create a file "server.js" in the "root" directory and write the below code:
const express = require('express');
const app = express();
const path = require('path');
app.use(express.static(path.join(__dirname, '/')));
app.get('/', function (req, res) {
console.log("__dirname : ",__dirname);
res.sendFile(path.join(__dirname, 'index.html'))
});
app.listen(3000, () => {
console.log("server is runnig on port 3000");
console.log("Open your browser and hit url 'localhost:3000'");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment