forked from Night-Magicians/NightMagicians
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
39 lines (30 loc) · 1.3 KB
/
server.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
// MODULES---------------------------------------
//-----------------------------------------------
var express = require('express');
var app = express();
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var Business = require('./app/models/bModel.js');
var User = require('./app/models/uModel.js');
// mongoose.connect('mongodb://localhost/Artisanal');
mongoose.connect('mongodb://aphinith:[email protected]:11495/artisanal')
// PORT------------------------------------------
var port = process.env.PORT || 5000;
// connect to our mongoDB database
// mongoose.connect(db.url);
// parse application/vnd.api+json as json
app.use(bodyParser.json());
app.use(bodyParser.json({ limit: '50mb', type: 'application/vnd.api+json' }));
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true, limit: '50mb' }));
app.use(express.static(__dirname + '/public'));
// routes ==================================================
require('./app/routes')(app); // configure our routes
app.use(express.static(__dirname + '/public'));
// start app ===============================================
// startup our app at http://localhost:3030
app.listen(port);
// shoutout to the user
console.log('Listening in on port ' + port);
// expose app
exports = module.exports = app;