-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLI.js
31 lines (23 loc) · 803 Bytes
/
CLI.js
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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(express.static('static'));
const mongoose = require('mongoose');
const mongoDb = 'mongodb://admin:[email protected]:27020/profile'
//const mongoDb = 'mongodb://localhost:27017/profile'
mongoose.connect(mongoDb, { useNewUrlParser: true });
mongoose.Promise = global.Promise;
require('./routes/commands')(app);
app.use(function (req, res, next){
console.log("HTTP request", req.method, req.url, req.body);
next();
});
app.use(function (req, res, next){
console.log("HTTP Response", res.statusCode);
next();
});
const PORT = 8000;
app.listen(PORT, () =>{
console.log("Started server on port", PORT);
});