LearningWebAppDev
LearningWebAppDev copied to clipboard
Express 4 Migration
Alex Koutmos was kind enough to send this information regarding the migration from Express 3 to Express 4. It is included below.
I found some good information here regarding Express 3->4 migration: http://scotch.io/bar-talk/expressjs-4-0-new-features-and-upgrading-from-3-0
And to specifically fix the issue in the server.js file, I did the following:
- 'npm install body-parser' in the project directory
- I then added 'bodyParser = require("body-parser")' in my server.js
- Lastly, instead of 'app.use(express.urlencoded())' I did 'app.use(bodyParser.urlencoded({"extended" : "true"}))'
Added this to our official errata page: http://learningwebappdev.com/errata/chapter6/2015/01/04/chapter-6-express-4-migration.html
Will update examples here soon, and will make sure the latest code in the book uses Express 4 in the next ebook update. Then I'll close this out.