This change makes id_service.js compatible with the latest nodejs versions. Signed-off-by: Matthias Dittrich <matthi.d@xxxxxxxxx> Reviewed-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxx> --- README.md | 2 +- id_service/id_service.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4574d23..277a67a 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ See `bugextractor/INSTALL` for all java-related details. * The ID service requires a few node.js packages. Install them by running - npm install addressparser express js-yaml mysql + npm install addressparser express js-yaml mysql body-parser in the `id_service` directory. diff --git a/id_service/id_service.js b/id_service/id_service.js index 2bb5afe..ab9f1ed 100644 --- a/id_service/id_service.js +++ b/id_service/id_service.js @@ -21,6 +21,7 @@ var mysql = require('mysql'); var yaml = require("js-yaml"); var logger = require('./logger'); var addressparser = require("addressparser"); +var bodyParser = require('body-parser'); // get property file name var fileName = process.argv[2]; @@ -63,10 +64,8 @@ var db_config = { }; var pool = mysql.createPool(db_config) -app.configure(function() { - // used to parse JSON object given in the body request - app.use(express.bodyParser()); -}); +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded()); /** * Obtain a connection from the pool, check if it works, and then execute -- 1.8.5.5