Skip to content

Instantly share code, notes, and snippets.

@shaikh-shahid
Last active January 7, 2019 17:05
Show Gist options
  • Save shaikh-shahid/cd9fd1702aeaaaa0134bb7f2927504d1 to your computer and use it in GitHub Desktop.
Save shaikh-shahid/cd9fd1702aeaaaa0134bb7f2927504d1 to your computer and use it in GitHub Desktop.
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