aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nodejs/main.js18
-rw-r--r--src/nodejs/response.js38
2 files changed, 28 insertions, 28 deletions
diff --git a/src/nodejs/main.js b/src/nodejs/main.js
index e02d741..4411081 100644
--- a/src/nodejs/main.js
+++ b/src/nodejs/main.js
@@ -5,7 +5,7 @@ var pg = require('pg');
var xmlGenerator = require('./xmlGenerator.js');
var opts = require('opts');
var osmRes = require('./response');
-var log4js = require('log4js')();
+var log4js = require('log4js')();
var log = log4js.getLogger('global');
var config;
@@ -51,8 +51,8 @@ function rowToNode(row){
'key' : temp[x],
'value' : temp[x+1]
});
- }
- }
+ }
+ }
return node;
}
@@ -73,8 +73,8 @@ function rowToWay(row){
'k' : temp[x],
'v' : temp[x+1]
});
- }
- }
+ }
+ }
return way;
}
@@ -98,7 +98,7 @@ function createWayBboxQuery(key, value, left, bottom, right, top) {
' st_setsrid(st_makepoint($3, $4), 4326), ' +
' st_setsrid(st_makepoint($5, $6), 4326) ' +
' ), 4326) ' +
- ')',
+ ')',
values: [key, value, left, bottom, right, top],
name: 'way bbox query'
};
@@ -152,7 +152,7 @@ function nodeWorldHandler(req, res, key, value) {
function nodeBboxHandler(req, res, key, value, left, bottom, right, top) {
res = osmRes.mkXmlRes(res);
-
+
dbConnect(res, function(client) {
var success = false;
var query = client.query(createNodeBboxQuery(key, value, left, bottom, right, top));
@@ -166,7 +166,7 @@ function nodeBboxHandler(req, res, key, value, left, bottom, right, top) {
});
query.on('row', function(row) {
- var pojo = rowToNode(row);
+ var pojo = rowToNode(row);
res.putNode(pojo);
});
});
@@ -259,7 +259,7 @@ function init(newConfig) {
log.info("server starting...");
log.info("loaded config from " + configPath);
http.createServer(myRoutes).listen(config.port, config.host);
- log.info("Started server at " + config.host + ":" + config.port );
+ log.info("Started server at " + config.host + ":" + config.port );
}
opts.parse(options, true);
diff --git a/src/nodejs/response.js b/src/nodejs/response.js
index 764726a..4be4df0 100644
--- a/src/nodejs/response.js
+++ b/src/nodejs/response.js
@@ -2,68 +2,68 @@ var xmlGen = require('./xmlGenerator');
// FIXME: this is a total mess
exports.mkJsonRes = function mkJsonRes(res){
res.started = false;
- res.atStart = function (){
+ res.atStart = function (){
if(!this.started){
this.writeHead(200);
this.write('json start start');
this.started = true;
- }
- }
+ }
+ }
res.atEnd = function(){
if(!this.started){
this.atStart(pojo);
- }
+ }
this.write('json enden');
this.end();
- }
+ }
res.putNode = function (pojo){
if(!this.started){
this.atStart(pojo);
- }
+ }
this.write(JSON.stringify(pojo));
- }
+ }
res.endWith500 = function(){
this.writeHead(500);
this.end();
- }
+ }
return res;
}
exports.mkXmlRes = function (res){
res.started = false;
- res.atStart = function (){
+ res.atStart = function (){
if(!this.started){
this.writeHead(200);
this.write(xmlGen.createHeader());
this.started = true;
- }
- }
+ }
+ }
res.atEnd = function(){
if(!this.started){
- this.atStart(pojo);
- }
+ this.atStart();
+ }
this.write('</osm>');
this.end();
- }
+ }
res.putWay = function (pojo){
if(!this.started){
this.atStart(pojo);
- }
+ }
this.write(xmlGen.createWay(pojo));
- }
+ }
res.putNode = function (pojo){
if(!this.started){
this.atStart(pojo);
- }
+ }
this.write(xmlGen.createNode(pojo));
- }
+ }
res.endWith500 = function(){
this.writeHead(500);
this.end();
- }
+ }
return res;
}