Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2288d0

Browse files
committed
Updated READMEs
1 parent c6861e3 commit d2288d0

File tree

10 files changed

+49
-31
lines changed

10 files changed

+49
-31
lines changed

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"eslint.autoFixOnSave": true
3-
}
2+
"eslint.autoFixOnSave": true,
3+
"editor.tabSize": 2
4+
}

week1/homework/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
'use strict';
22

3-
// Write the homework code in this file
3+
// TODO: Write the homework code in this file

week2/homework/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ node index.js reset
6363

6464
## Bonus assignment
6565

66-
- Use JSON to store to-dos and add following commands
66+
- Use JSON to store to-dos
6767
- Split each action (i.e. read, write, etc.) into a separate file
6868
- Use [commander](https://www.npmjs.com/package/commander) library to implement
6969
command line interface
7070

71+
Add following commands:
72+
7173
### `update`
7274

7375
Updates a to-do item with new text:
@@ -79,4 +81,5 @@ node index.js update 3 "Brush teeth"
7981
### Things to consider
8082

8183
- What representation you use in your file (CSV, TSV, JSON, etc).
82-
- Handle edge cases, i.e. control what happens if user enters unexpected input
84+
- Handle edge cases, i.e. control what happens if user enters unexpected input,
85+
e.g. `remove -100`.

week2/homework/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
'use strict';
22

3-
// Write the homework code in this file
3+
// TODO: Write the homework code in this file

week2/lecture/src/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
const fs = require('fs');
44

5-
const STORE_FILE_NAME = 'store.txt';
5+
const DEFAULT_ENCODING = 'utf8';
6+
const STORE_FILE_NAME = 'store.txt';
67

78
function readFile() {
89
return new Promise(
910
resolve => fs.readFile(
1011
STORE_FILE_NAME,
11-
(err, data) => resolve(err ? '' : data.toString())
12+
DEFAULT_ENCODING,
13+
(err, data) => resolve(err ? '' : data)
1214
)
1315
);
1416
}
1517

16-
function writeFile(...text) {
18+
function appendFile(...text) {
1719
return new Promise(
1820
(resolve, reject) => fs.appendFile(
1921
STORE_FILE_NAME,
@@ -51,7 +53,7 @@ switch (cmd) {
5153
break;
5254

5355
case 'write':
54-
writeFile(...args)
56+
appendFile(...args)
5557
.then(() => console.log('Wrote to-do to file'))
5658
.then(() => readFile())
5759
.then(data => console.log(`\nTo-Dos:\n${data}`))

week3/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
## Last week's summary
1818

19-
Last week we made a CLI To-Do application. This week we are going to rewrite
19+
Last week we made a CLI To-Do application. This week we are going to rewrite it
2020
into an Express-based server.
2121

2222
## Testing with Postman
@@ -53,10 +53,10 @@ Documentation:
5353

5454
### To-Do API
5555

56-
This is an Express application using [body-parser](https://github.com/expressjs/body-parser) middleware that automatically parser
57-
JSON from request body.
56+
This week we are going to write an Express application using [body-parser](https://github.com/expressjs/body-parser)
57+
middleware that automatically parses JSON from request body.
5858

59-
There are currently 4 [CRUD](https://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete)
59+
There are 4 [CRUD](https://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete)
6060
actions:
6161

6262
- Create (`POST /todos`)

week3/homework/README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@
22

33
### Assignment
44

5-
- Read through the code from the lecture, make sure you understand the flow of
6-
the program
7-
- Add three more actions
8-
- `clear` (`DELETE /todos`) which will clear the list of todos
9-
- `markAsDone` (`POST /todos/:id/done`) which will set the `done` flag of a single todo to `true`
10-
- `markAsNotDone` (`DELETE /todos/:id/done`) which will set the `done` flag of a single todo to `false`
11-
- Update your README to reflect your new actions!
12-
13-
Take care of the following:
14-
15-
- All requests that need a body should be in JSON, and follow the request structure of the other actions
16-
- All responses should be in JSON, and follow the response structure of the other actions
5+
Read through the code from the lecture, make sure you understand the flow of the
6+
program.
7+
8+
Add three more actions and update your `README.md` to reflect your new actions.
9+
10+
### `clear` (`DELETE /todos`)
11+
12+
Clears the list of to-dos
13+
14+
### `markAsDone` (`POST /todos/:id/done`)
15+
16+
Sets the `done` flag of a single to-do to `true`
17+
18+
### `markAsNotDone` (`DELETE /todos/:id/done`)
19+
20+
Sets the `done` flag of a single to-do to `false`
21+
22+
## Requirements
23+
24+
- All requests that need a body should be in JSON format, and follow the request
25+
structure of the other actions
26+
- All responses should be in JSON format, and follow the response structure of
27+
the other actions
1728
- Follow the anatomy of the project
18-
- Make your code DRY (see https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)
19-
- Follow the REST design principles: use the proper method, response status codes, and consistent URL paths
29+
- Make sure your code is [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)
30+
- Follow the REST design principles: use the proper method, response status
31+
codes, and consistent URL paths
2032
- Test your API using Postman

week3/homework/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
'use strict';
22

3-
// Write the homework code in this file
3+
// TODO: Write the homework code in this file

week3/lecture/src/actions/delete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// delete is a JavaScript keywoard, using delete_ instead
3+
// delete is a JavaScript keyword, using delete_ instead
44
function delete_(todo, request, response) {
55
const id = request.params.id;
66

week3/lecture/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const {
88
create,
99
read,
1010
update,
11-
// delete is a JavaScript keywoard, using delete_ instead
11+
// delete is a JavaScript keyword, using delete_ instead
1212
delete_
1313
} = require('./actions');
1414

0 commit comments

Comments
 (0)