-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (29 loc) · 970 Bytes
/
app.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
32
33
34
35
36
37
38
39
40
var express=require('express');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var path = require('path');
var app=express();
app.use(express.static(__dirname + './index.html'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
var port = process.env.PORT || 3000;
app.use(express.static(__dirname + '/public'));
app.listen(port,function(){
console.log('App running on PROT : '+ port,'\nPress Ctrl + C to terminate');
});
mongoose.connect('localhost', 'replenishment', function(err){
if(err){
console.log('Database connection error: ' + err);
process.exit(1);
}
});
mongoose.connection.on('connected', function() {
//var walmart = require('./server/models/model.walmart')(app);
require('./server/models/model.forcast')(app);
require('./server/routes/routes.forcast')(app);
});
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/public/index.html'));
});