[solved] Most middleware (like json) is no longer bundled with Express and must be installed separately.

if you get error like this:

root@yanipra:/var/www/helloHerokuMongoDB# foreman start
10:41:06 web.1  | started with pid 18124
10:41:06 web.1  | 
10:41:06 web.1  | Error: Most middleware (like json) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
10:41:06 web.1  |     at Function.Object.defineProperty.get (/var/www/helloHerokuMongoDB/node_modules/express/lib/express.js:89:13)
10:41:06 web.1  |     at Object.<anonymous> (/var/www/helloHerokuMongoDB/app.js:16:17)
10:41:06 web.1  |     at Module._compile (module.js:456:26)
10:41:06 web.1  |     at Object.Module._extensions..js (module.js:474:10)
10:41:06 web.1  |     at Module.load (module.js:356:32)
10:41:06 web.1  |     at Function.Module._load (module.js:312:12)
10:41:06 web.1  |     at Function.Module.runMain (module.js:497:10)
10:41:06 web.1  |     at startup (node.js:119:16)
10:41:06 web.1  |     at node.js:906:3
10:41:06 web.1  | exited with code 8

ok, to solve a problem check your app.js

var app = express();
app.use(express.json());       // to support JSON-encoded bodies
app.use(express.urlencoded()); 
app.use(logger);

looks you are using express.json() and express.urlencoded()..that point in your problem. check on website https://github.com/senchalabs/connect#middleware. on there, Explain about how to using urlencoded with bodyparser.. ok let’s change..

var app = express();
app.use(bodyParser.urlencoded());
app.use(bodyParser.json());
app.use(logger);

ok, thank’s for watching hiihihi kyak nonton tv aja..😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s