I am trying to write a simple html page that upon a button click, send a value from a text input field to node server, which then prints on the console of the entered value. know that with express 4 the previous bodyparser is deprecated and following the discussion here: bodyParser is deprecated express 4
But with the following code I still get errors when starting the server:
var express = require('express');
var app = express();
app.use(express.static('resources'));
app.use(express.static(__dirname));
app.use(express.bodyParser.urlencoded());
app.get('/', function (req, res) {
   res.sendFile( __dirname + "/" + "index.html" );
})
app.post('/java_preview', function (req, res) {
   console.log("Request for java_preivew:");
   console.log(req.body.url);
})
var server = app.listen(3000, function () {
  console.log("Server started...")
  var host = server.address().address
  var port = server.address().port
  console.log("Listening at http://%s:%s", host, port)
})
HTML:
$(document).ready(function(){
        $('#previewButton').click(function () {
            //var enterURL=$('inputUrl').val();
            //alert("Button Clicked:"+$('#inputUrl').val());
            $.post("java_preview", {url: $('#inputUrl').val()} );
        });
      });
error log:
/Users/-/Google Drive/papers/ISWC2016_demo/webpages/node_modules/express/lib/express.js:99
      throw new Error('Most middleware (like ' + name + ') is no longer bundle
            ^
Error: Most middleware (like bodyParser) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
    at Function.Object.defineProperty.get (/Users/-/Google Drive/papers/ISWC2016_demo/webpages/node_modules/express/lib/express.js:99:13)
    at Object.<anonymous> (/Users/-/Google Drive/papers/ISWC2016_demo/webpages/startserver.js:6:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
any suggestions please
 
     
     
    