-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (25 loc) · 804 Bytes
/
Copy pathapp.js
File metadata and controls
31 lines (25 loc) · 804 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
require('./api/data/db.js');
var express =require('express');
var app = express();
var path=require('path');
var routes =require('./api/routes');
var bodyParser = require('body-parser')
app.set('port',3000);
app.use(function(req,res,next){
console.log(req.method,req.url);
next();
});
app.use(express.static(path.join(__dirname,'/public')));
app.use('/node_modules',express.static(path.join(__dirname+'/node_modules')));
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.use('/api',routes);
/*app.get('/',function(req,res){
console.log("Go to homepage");
res.sendFile(path.join(__dirname,'public','index.html'));
});*/
var server=app.listen(app.get('port'),function(){
var port = server.address().port;
console.log('magic! '+port);
});
console.log('first');