回答編集履歴

1

「## 私ならこう書く」のコードのミスを修正

2017/07/19 01:58

投稿

ndxbn
ndxbn

スコア30

test CHANGED
@@ -26,9 +26,9 @@
26
26
 
27
27
  ```fix_typo.diff
28
28
 
29
- --- /var/tmp/84668/routes/route2.js Tue Jul 18 14:40:24 2017
29
+ --- /var/tmp/84668/routes/route.js Tue Jul 18 14:40:03 2017
30
30
 
31
- +++ /var/tmp/84668/routes/route.js Tue Jul 18 14:40:03 2017
31
+ +++ /var/tmp/84668/routes/route2.js Tue Jul 18 14:40:24 2017
32
32
 
33
33
  @@ -10,7 +10,7 @@
34
34
 
@@ -38,9 +38,9 @@
38
38
 
39
39
  }).post(function(req, res) {
40
40
 
41
- - articles.push(req.body); // typo
41
+ - articles.push(req.boby); // typo
42
42
 
43
- + articles.push(req.boby);
43
+ + articles.push(req.body);
44
44
 
45
45
  res.redirect("/articles");
46
46
 
@@ -98,13 +98,11 @@
98
98
 
99
99
  // pages
100
100
 
101
- router.get("/", function(req, res) {
101
+ router.get('/', function(req, res) {
102
102
 
103
103
  const responseBody = formTemplate +
104
104
 
105
105
  '<code>' + JSON.stringify(articles) + '</code>';
106
-
107
- res.send(responseBody);
108
106
 
109
107
  res.send(responseBody);
110
108
 
@@ -114,7 +112,7 @@
114
112
 
115
113
  // APIs
116
114
 
117
- router.route("/articles")
115
+ router.route('/articles')
118
116
 
119
117
  .get(function(req, res) {
120
118
 
@@ -126,7 +124,7 @@
126
124
 
127
125
  articles.push(req.body);
128
126
 
129
- res.redirect("/"); // 表示用のページにリダイレクト
127
+ res.redirect('/'); // 表示用のページにリダイレクト
130
128
 
131
129
  });
132
130