File tree 3 files changed +51
-4
lines changed
3 files changed +51
-4
lines changed Original file line number Diff line number Diff line change 42
42
```
43
43
async mounted () {
44
44
45
- let response = await fetch("http://localhost:3000/api/users/spooky /tasks");
45
+ let response = await fetch("http://localhost:3000/api/users/hellojs /tasks");
46
46
let result = await response.json();
47
47
48
48
result.tasks.forEach((task) => {
96
96
completed: false
97
97
}
98
98
99
- let response = await fetch('http://localhost:3000/api/users/spooky /tasks/create', {
99
+ let response = await fetch('http://localhost:3000/api/users/hellojs /tasks/create', {
100
100
method: 'post',
101
101
headers: {"Content-Type": "application/json"},
102
102
body: JSON.stringify(data)
Original file line number Diff line number Diff line change 2
2
3
3
## Story
4
4
5
- 為了提供使用者可以記錄各自的待做項目,需要提供後台可以新增使用者,必且讓使用者可以自行新增待做事項 。
5
+ 為了提供使用者可以記錄各自的待做項目,需要提供後台可以新增使用者,並且讓使用者可以自行新增待做事項 。
6
6
7
7
## 測試方式
8
8
Original file line number Diff line number Diff line change 6
6
7
7
## 步驟
8
8
9
+ ### 後端調整
10
+
9
11
* model Task 新增 completed 欄位紀錄 Task 是否被完成
12
+
13
+ * migration 程序新增 model Task 欄位 completed
14
+
15
+ 新增 migration 檔案指令
16
+
17
+ ` node_modules/.bin/sequelize migration:create --name task-add-completed `
18
+
19
+
20
+ ```
21
+ module.exports = {
22
+ up: (queryInterface, Sequelize) => {
23
+ queryInterface.addColumn(
24
+ 'Todo',
25
+ 'completed',
26
+ Sequelize.BOOLEAN
27
+ );
28
+ },
29
+
30
+ down: (queryInterface, Sequelize) => {
31
+ queryInterface.removeColumn(
32
+ 'Todo',
33
+ 'completed'
34
+ );
35
+ }
36
+ };
37
+
38
+ ```
39
+
40
+ 執行下列指令更新 database
41
+
42
+ ` node_modules/.bin/sequelize db:migrate `
43
+
44
+
10
45
* 撰寫 test case 確認更新 model Task completed 成功
11
46
* 新增 test 定義 task 更新 completed 之 API spec
12
47
* 實作 Task completed 更新 API 並且透過 test 驗證 API
13
48
* 調整後端頁面顯示 completed 的值
49
+
50
+ ### 前端調整
51
+
14
52
* 調整前端針對 completed 的變動,呼叫完成的 API
15
- * 確認在前端調整的 completed 之變動,在後端看到的是相同的變動
53
+
16
54
17
55
18
56
## 測試方式
22
60
3 . 假設新增 task 成功,進入後台,可以看到該使用者的特定 Task 狀態為已完成
23
61
4 . 若再次在前台變更完成狀態為未完成,則可以在後台看到顯示該 Task 顯示為未完成
24
62
63
+ ## 解答
64
+
65
+ ### 後端
66
+
67
+ https://github.com/agileworks-tw/express-example/pull/1
68
+
69
+ ### 前端
70
+
71
+ https://github.com/agileworks-tw/express-example-vue/pull/1
You can’t perform that action at this time.
0 commit comments