Skip to content

Commit a62667a

Browse files
committed
small bug fixes and wording
1 parent 5564edb commit a62667a

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ Then **clone**, **install**, and **run** the app:
5151

5252
```sh
5353
# Clone the repo to your local machine (This just clones, it does not "install")
54-
$ git clone https://github.com/ReactTraining/node-workshop.git
54+
$ git clone https://github.com/ReactTraining/javascript-node-workshop.git
5555

5656
# Whichever directory you run the above command from, that directory should
57-
# now have a folder called `node-workshop`.
57+
# now have a folder called `javascript-node-workshop`.
5858

59-
# Change directory to the `node-workshop` folder:
60-
$ cd node-workshop
59+
# Change directory to the `javascript-node-workshop` folder:
60+
$ cd javascript-node-workshop
6161

62-
# Install and run. Make sure you do these two commands from within the `node-workshop` folder:
62+
# Install and run. Make sure you do these two commands from within the `javascript-node-workshop` folder:
6363
$ npm install
6464
$ npm start
6565

lessons/01-js-and-node/lecture/NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- MDN is the official documentation for JS?
88
- NVM
99
- How version numbers work
10-
- Now NPM and package.json works
10+
- How NPM and package.json works
1111
- package.json scripts
1212
- Modules (CommonJS vs ESM)
1313
- ✅ Scope

lessons/05-cli/practice/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let selectedLesson = ''
1111
let lessonType = ''
1212
let lessonFiles: string[] = []
1313

14-
const lessonsPath = path.resolve(__dirname /* 🔴 FINISH THIS - SEE README */)
14+
const lessonsPath = path.resolve(__dirname /* 🔴 FINISH THIS - SEE GUIDE.md */)
1515
const lessonFolders = fs.readdirSync(lessonsPath).filter((item) => {
1616
return fs.lstatSync(path.resolve(lessonsPath, item)).isDirectory()
1717
})

lessons/06-server/practice/GUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ You need to get two paths working:
77
- `/users` needs to return an array of user objects
88
- `/users/:id` needs to return a user object
99

10-
Both routes are already made. In each one, use the `db.query('SELECT * FROM ...')` API to perform an SQL search for what you want. We also gave you some SQL examples in the file. The users in this mini database have id's ranging from 1 to 4.
10+
Both routes are already made. In each one, use the `query('SELECT * FROM ...')` API to perform an SQL search for what you want. We also gave you some SQL examples in the file. The users in this mini database have id's ranging from 1 to 4.
1111

1212
**Here's what you have to do:**
1313

14-
- `db.query` returns a promise with an array of results. since the results are an array, you'll need to use `res.json(results)` to serialize them into a JSON response.
14+
- `query` returns a promise with an array of results. since the results are an array, you'll need to use `res.json(results)` to serialize them into a JSON response.
1515
- If `results.length` is 0, then we should respond with a 404 status code since they're trying to access a user that doesn't exist. Also respond with a 404 status if the parameter that was given is not an integer.
1616
- For 404 status codes, we already have a route towards the end that handles all requests that were not handled by previous routes. So in the user-based routes, all you would have to do is call `next()` which is sort of like doing `continue` in a loop -- `next()` will move on from the route it's called in to the next route that matches. But no other routes will match, thus our 404 response will work like a charm ☘️
17-
- If you pass a string into `db.query` that doesn't start with `SELECT`, the promise will reject, so be sure to have a `.catch` that will respond with a status code of 500. Similar to the 404 code, all you have to do is call `next(err)` but this time with a string argument:
17+
- If you pass a string into `query` that doesn't start with `SELECT`, the promise will reject, so be sure to have a `.catch` that will respond with a status code of 500. Similar to the 404 code, all you have to do is call `next(err)` but this time with a string argument:
1818

1919
Calling `next()` with no argument just tells express to go to the next route. Calling `next(str)` with an argument tells express to go to the error handling route.

lessons/06-server/practice/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ app.get('/', (req, res) => {
1010
})
1111

1212
app.get('/users', (req, res, next) => {
13-
// db.query('SELECT * FROM user')
13+
// query('SELECT * FROM user')
1414
res.json({})
1515
})
1616

@@ -20,7 +20,7 @@ app.get('/users/:id', (req, res, next) => {
2020
// Parameters always come as strings. So verify it's a valid numeric string with `isInteger(id)`
2121
// and respond with a 404 not found if it's not valid
2222

23-
// db.query('SELECT * FROM user WHERE user.id = 1')
23+
// query('SELECT * FROM user WHERE user.id = 1')
2424
res.json({})
2525
})
2626

0 commit comments

Comments
 (0)