server update
This commit is contained in:
parent
806e03ae48
commit
2a06128515
1 changed files with 11 additions and 11 deletions
22
server.js
22
server.js
|
@ -1,18 +1,19 @@
|
||||||
// OpenShift sample Node application
|
// OpenShift sample Node application
|
||||||
var express = require('express'),
|
var express = require('express'),
|
||||||
//fs = require('fs'),
|
fs = require('fs'),
|
||||||
app = express(),
|
app = express(),
|
||||||
//eps = require('ejs'),
|
eps = require('ejs'),
|
||||||
//morgan = require('morgan'),
|
morgan = require('morgan'),
|
||||||
mongoose = require('mongoose'),
|
mongoose = require('mongoose'),
|
||||||
Task = require('./api/models/todoListModel'),
|
Task = require('./api/models/todoListModel'),
|
||||||
bodyParser = require('body-parser');
|
bodyParser = require('body-parser');
|
||||||
|
|
||||||
//Object.assign=require('object-assign')
|
Object.assign=require('object-assign')
|
||||||
/*
|
|
||||||
app.engine('html', require('ejs').renderFile);
|
app.engine('html', require('ejs').renderFile);
|
||||||
app.use(morgan('combined'))
|
app.use(morgan('combined'))
|
||||||
*/
|
|
||||||
|
|
||||||
var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080,
|
var port = process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 8080,
|
||||||
ip = process.env.IP || process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0',
|
ip = process.env.IP || process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0',
|
||||||
mongoURL = process.env.OPENSHIFT_MONGODB_DB_URL || process.env.MONGO_URL,
|
mongoURL = process.env.OPENSHIFT_MONGODB_DB_URL || process.env.MONGO_URL,
|
||||||
|
@ -46,9 +47,9 @@ app.use(bodyParser.json());
|
||||||
|
|
||||||
var routes = require('./api/routes/todoListRoutes');
|
var routes = require('./api/routes/todoListRoutes');
|
||||||
routes(app);
|
routes(app);
|
||||||
/*
|
|
||||||
var db = null,
|
|
||||||
dbDetails = new Object();
|
var db = null, dbDetails = new Object();
|
||||||
|
|
||||||
var initDb = function(callback) {
|
var initDb = function(callback) {
|
||||||
if (mongoURL == null) return;
|
if (mongoURL == null) return;
|
||||||
|
@ -113,8 +114,7 @@ app.use(function(err, req, res, next){
|
||||||
initDb(function(err){
|
initDb(function(err){
|
||||||
console.log('Error connecting to Mongo. Message:\n'+err);
|
console.log('Error connecting to Mongo. Message:\n'+err);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
app.listen(port, ip);
|
app.listen(port, ip);
|
||||||
console.log('Server running on http://%s:%s', ip, port);
|
console.log('Server running on http://%s:%s', ip, port);
|
||||||
|
|
||||||
module.exports = app ;
|
module.exports = app ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue