From 6381fd3acad67cb35de011be53b6fb839dd4f493 Mon Sep 17 00:00:00 2001 From: chelm Date: Tue, 10 Feb 2015 15:43:02 -0600 Subject: [PATCH] fixing default POST routes and worker exits on errors --- index.js | 1 + lib/ExportWorker.js | 1 + lib/GeoJSON.js | 6 +++--- package.json | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8ab18a751..bcc56d0e2 100644 --- a/index.js +++ b/index.js @@ -95,6 +95,7 @@ module.exports = function( config ) { if ( controller[ handler ] ){ defaultRoutes[ handler ].forEach(function(route){ app[ 'get' ]( '/'+ name + pattern + route, controller[ handler ]); + app[ 'post' ]( '/'+ name + pattern + route, controller[ handler ]); }); } } diff --git a/lib/ExportWorker.js b/lib/ExportWorker.js index ace9087e9..641bf3fd2 100644 --- a/lib/ExportWorker.js +++ b/lib/ExportWorker.js @@ -192,6 +192,7 @@ function createFiles(job, done){ info.generating = { error: e }; koop.Cache.updateInfo( task.table, info, function(err, res){ done('failed to generate file ' + e); + workerQ.kill(); cb(); }); } diff --git a/lib/GeoJSON.js b/lib/GeoJSON.js index 3f310ecf5..21462058b 100644 --- a/lib/GeoJSON.js +++ b/lib/GeoJSON.js @@ -135,8 +135,8 @@ exports.fromEsri = function( fields, json, callback ){ } catch (e){ if ( dateFields.length ){ dateFields.forEach(function(d,i){ - if ( newFeature.attributes[d] ){ - feature.attributes[d] = new Date(feature.attributes[d]).toISOString(); + if ( f.attributes[d] ){ + f.attributes[d] = new Date(f.attributes[d]).toISOString(); } }); } @@ -147,7 +147,7 @@ exports.fromEsri = function( fields, json, callback ){ geometry: null }; geojson.features.push( newFeature ); - console.log('error parsing feature', e, f); + //console.log('error parsing feature', e, f); } }); callback(null, geojson); diff --git a/package.json b/package.json index d27367e65..14ebf0a37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koop", - "version": "1.0.13", + "version": "1.0.14", "description": "A node module/express middleware for converting GeoJSON to Esri Feature Services.", "main": "index.js", "scripts": {