forked from paulsjv/leansheets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.js
More file actions
26 lines (19 loc) · 617 Bytes
/
web.js
File metadata and controls
26 lines (19 loc) · 617 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var express = require('express');
var app = express();
var port = process.env.PORT || 8000;
var router = express.Router();
// route middleware that will happen on every request
router.use(function(req, res, next) {
// log each request to the console
console.log(req.method, req.url);
// continue doing what we were doing and go to the route
next();
});
// home page route (http://localhost:8080)
router.get('/', function(req, res) {
res.sendfile('./src/index.html');
});
app.use(express.static(__dirname + '/src'));
app.use('/', router);
app.listen(port);
console.log("App listening on port " + port);