Skip to content

Commit 95d6c83

Browse files
committed
Update dep to express 4
1 parent 8c4604a commit 95d6c83

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Code from the React tutorial.",
55
"main": "server.js",
66
"dependencies": {
7-
"express": "3.12.1"
7+
"body-parser": "^1.4.3",
8+
"express": "^4.4.5"
89
},
910
"devDependencies": {},
1011
"scripts": {

server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
var express = require('express');
2+
var bodyParser = require('body-parser');
23
var app = express();
34

45
var comments = [{author: 'Pete Hunt', text: 'Hey there!'}];
56

67
app.use('/', express.static(__dirname));
7-
app.use(express.bodyParser());
8+
app.use(bodyParser.json());
9+
app.use(bodyParser.urlencoded({extended: true}));
810

911
app.get('/comments.json', function(req, res) {
1012
res.setHeader('Content-Type', 'application/json');
@@ -18,3 +20,5 @@ app.post('/comments.json', function(req, res) {
1820
});
1921

2022
app.listen(3000);
23+
24+
console.log('Server started: http://localhost:3000/');

0 commit comments

Comments
 (0)