Permalink
Browse files

configure openshift

  • Loading branch information...
1 parent 99cfb3c commit 4b0352ad8c18c3fe0f75ab0db6e8f2c4076eba6a xFontroSF committed Oct 8, 2012
Showing with 8 additions and 8 deletions.
  1. +7 −7 server.js → app.js
  2. +1 −1 package.json
View
@@ -5,8 +5,8 @@ var url = require("url"),
args = require("commander"),
cluster = require("cluster");
-var ipaddr = process.env.OPENSHIFT_INTERNAL_IP || "127.0.0.1", //"192.168.7.171",
- port = process.env.OPENSHIFT_INTERNAL_PORT || "8080";
+//var ipaddr = process.env.VMC_APP_PORT || process.env.OPENSHIFT_INTERNAL_IP || "192.168.7.163",
+var port = process.env.VMC_APP_PORT || process.env.OPENSHIFT_INTERNAL_PORT || "8080";
var app = express(),
handle = {};
@@ -44,31 +44,31 @@ if(cluster.isMaster) {
}else {
response.json(200, {resultat: resultat});
}
- })});
+ });});
app.post("/restar", function(request, response){operacionsAritmetiques.restar(request.body.op1, request.body.op2, function(error, resultat){
if(error){
response.json(error.errorCode, { error: error.errorDescription });
}else {
response.json(200, {resultat: resultat});
}
- })});
+ });});
app.post("/multiplicar", function(request, response){operacionsAritmetiques.multiplicar(request.body.op1, request.body.op2, function(error, resultat){
if(error){
response.json(error.errorCode, { error: error.errorDescription });
}else {
response.json(200, {resultat: resultat});
}
- })});
+ });});
app.post("/dividir", function(request, response){operacionsAritmetiques.dividir(request.body.op1, request.body.op2, function(error, resultat){
if(error){
response.json(error.errorCode, { error: error.errorDescription });
}else {
response.json(200, {resultat: resultat});
}
- })});
+ });});
app.get("/:operation", function (request, response, next){
var op = handle[request.params.operation];
@@ -92,6 +92,6 @@ if(cluster.isMaster) {
response.json(404, {error:'404 Not Found'});
});
- app.listen(args.port,ipaddr);
+ app.listen(port);//args.port,ipaddr);
console.log("Server has started at: "+ipaddr+":"+port);
}
View
@@ -28,7 +28,7 @@
"bundleDependencies": [],
"scripts": {
- "start": "node ./server.js"
+ "start": "node ./app.js -c"
},
"private": true

0 comments on commit 4b0352a

Please sign in to comment.