Created
April 26, 2020 18:39
-
-
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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