-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (23 loc) · 894 Bytes
/
app.js
File metadata and controls
31 lines (23 loc) · 894 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
var port = 8080;
var express = require('express');
var app = express();
var path = require('path');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
mongoose.Promise = Promise;
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// Serve static content at virtual fs paths
app.use('/angular', express.static(path.join(__dirname, '/node_modules/angular')));
app.use('/static', express.static(path.join(__dirname, 'public')));
// Connect to database
var db_username = "DisruptHC";
var db_password = "HenryRutgers";
var db_url = "mongodb://" + db_username + ":" + db_password + "@ds123370.mlab.com:23370/bookgenius";
mongoose.connect(db_url);
// Express routes defined in external file
var routes = require('./routes/routes');
// Set root path
app.use('/', routes);
app.listen(port);
console.log('Server listening on port ' + port);