Last active
January 7, 2019 17:05
-
-
Save shaikh-shahid/cd9fd1702aeaaaa0134bb7f2927504d1 to your computer and use it in GitHub Desktop.
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'); | |
const router = express.Router(); | |
router.get('/',function(req,res){ | |
res.sendFile(path.join(__dirname+'/index.html')); | |
//__dirname : It will resolve to your project folder. | |
}); | |
router.get('/about',function(req,res){ | |
res.sendFile(path.join(__dirname+'/about.html')); | |
}); | |
router.get('/sitemap',function(req,res){ | |
res.sendFile(path.join(__dirname+'/sitemap.html')); | |
}); | |
//add the router | |
app.use('/', router); | |
app.listen(process.env.port || 3000); | |
console.log('Running at Port 3000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment