Skip to content

Instantly share code, notes, and snippets.

@ProfAvery
Last active October 18, 2016 06:11
Show Gist options
  • Save ProfAvery/6f7c9f5b1e06977aacbce4ccaf7bf2b4 to your computer and use it in GitHub Desktop.
Save ProfAvery/6f7c9f5b1e06977aacbce4ccaf7bf2b4 to your computer and use it in GitHub Desktop.
Updates to Chapter6/app/Amazeriffic/server.js for Express 4.x
diff --git a/Chapter6/app/Amazeriffic/server.js b/Chapter6/app/Amazeriffic/server.js
index fc11916..dceaa69 100644
--- a/Chapter6/app/Amazeriffic/server.js
+++ b/Chapter6/app/Amazeriffic/server.js
@@ -1,5 +1,6 @@
var express = require("express"),
http = require("http"),
+ bodyParser = require("body-parser"),
app = express(),
toDos = [
{
@@ -32,7 +33,7 @@ app.use(express.static(__dirname + "/client"));
// tell Express to parse incoming
// JSON objects
-app.use(express.urlencoded());
+app.use(bodyParser.json());
http.createServer(app).listen(3000);
@ProfAvery
Copy link
Author

To get these changes to work, you'll need to run

npm install body-parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment