-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (27 loc) · 723 Bytes
/
server.js
File metadata and controls
35 lines (27 loc) · 723 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
27
28
29
30
31
32
33
34
35
var express = require("express");
var morgan = require('morgan');
var app = express();
var router = express.Router();
var path = __dirname + '/views/';
app.use(morgan('combined'));
app.use(express.static(__dirname + '/public'));
/**router.use(function (req,res,next) {
console.log("/" + req.method);
next();
});*/
router.get("/",function(req,res){
res.sendFile(path + "index.html");
});
router.get("/about",function(req,res){
res.sendFile(path + "about.html");
});
router.get("/contact",function(req,res){
res.sendFile(path + "contact.html");
});
app.use("/",router);
app.use("*",function(req,res){
res.sendFile(path + "404.html");
});
app.listen(3000,function(){
console.log("Live at Port 3000");
});