-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·51 lines (39 loc) · 1.42 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
40
41
42
43
44
45
46
47
48
49
50
51
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
//mongoose.connect(process.env.OPENSHIFT_MONGODB_DB_URL || 'mongodb://localhost/test');
//var db = mongoose.connection;
var connectionString = 'mongodb://127.0.0.1:27017/cs5610-triptorque';
if(process.env.OPENSHIFT_MONGODB_DB_PASSWORD) {
connectionString = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" +
process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "@" +
process.env.OPENSHIFT_MONGODB_DB_HOST + ':' +
process.env.OPENSHIFT_MONGODB_DB_PORT + '/' +
process.env.OPENSHIFT_APP_NAME;
}
var db = mongoose.connect(connectionString);
app.use(express.static(__dirname + '/public'));
var address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1';
var port = process.env.OPENSHIFT_NODEJS_PORT || 3000;
//app.get('/', function (req, res) {
// res.send('Hello World')
//})
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
//var CourseSchema = new mongoose.Schema({
// title:String
//
//},{collection:"course"});
//
//
//var Course = mongoose.model("Course",CourseSchema);
//
//Course.create({title:"Mongo"},
// function(err,result){
//// console.log(err);
//// console.log(result);
//});
//require("./public/Assignment/server/app.js")(app,mongoose,db);
require("./public/Project56/server/app.js")(app,mongoose,db);
app.listen(port,address);