var express = require('express');
var router = express.Router();
// middleware that is specific to this router
router.use(function timeLog (req, res, next) {
console.log('Time: ', Date.now());
next();
});
// define the home page route
router.get('/', function (req, res) {
res.send('Birds home page');
});
// define the about route
router.get('/about', function (req, res) {
res.send('About birds');
});
module.exports = router;
// use Express
// use Path
const express = require('express');
const path = require('path');
const app = express();
// ###Create Public folder
app.use(express.static('./public'));
app.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname, './navbar-app/index.html'));
});
app.all('*', (req, res) => {
res.status(404).send('Resource not founded');
})
app.listen(5000, () => {
console.log('Server is listening on PORT: 5000');
});