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

Skip to content

Commit 9eec2b2

Browse files
committed
Added week 2 lecture example and updated homework assignment
1 parent d5fd45a commit 9eec2b2

22 files changed

+1445
-89
lines changed

.vscode/launch.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
{
88
"type": "node",
99
"request": "launch",
10-
"name": "Launch Week 1",
11-
"program": "${workspaceFolder}/week1/src/index.js",
12-
"cwd": "${workspaceFolder}/week1"
10+
"name": "Launch Week 1 - Lecture",
11+
"program": "${workspaceFolder}/week1/lecture/src/index.js",
12+
"cwd": "${workspaceFolder}/week1/lecture"
1313
},
1414
{
1515
"type": "node",
1616
"request": "launch",
17-
"name": "Launch Week 2",
18-
"program": "${workspaceFolder}/week2/src/index.js",
19-
"cwd": "${workspaceFolder}/week2"
17+
"name": "Launch Week 2 - Lecture",
18+
"program": "${workspaceFolder}/week2/lecture/src/index.js",
19+
"cwd": "${workspaceFolder}/week2/lecture"
2020
},
2121
{
2222
"type": "node",
2323
"request": "launch",
24-
"name": "Launch Week 3",
25-
"program": "${workspaceFolder}/week3/src/index.js",
26-
"cwd": "${workspaceFolder}/week3"
24+
"name": "Launch Week 3 - Lecture",
25+
"program": "${workspaceFolder}/week3/lecture/src/index.js",
26+
"cwd": "${workspaceFolder}/week3/lecture"
2727
}
2828
]
2929
}

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,29 @@ developer".
1111

1212
| Week | Topic | Read | Homework |
1313
| ---: | ------------------ | --------------------------------- | ------------------------------------------- |
14-
| 0. | Introduction | [Week 0 Reading](week0/README.md) | None |
1514
| 1. | Node.js, npm, http | [Week 1 Reading](week1/README.md) | [Week 1 Homework](week1/homework/README.md) |
1615
| 2. | fs, process | [Week 2 Reading](week2/README.md) | [Week 2 Homework](week2/homework/README.md) |
1716
| 3. | express, REST | [Week 3 Reading](week3/README.md) | [Week 3 Homework](week3/homework/README.md) |
1817

18+
## Watch before your first Node.js session
19+
20+
- Watch Jason's playlist on [Lynda.com]
21+
(https://www.lynda.com/SharedPlaylist/a850f6b7bddf437f8b98679f5f9d9cc3) (45 min)
22+
23+
## Promises' refresher
24+
25+
Jim's [summary of promises](https://github.com/remarcmij/JavaScript/blob/master/fundamentals/promises.md)
26+
from JavaScript module.
27+
28+
## Node.js Setup
29+
30+
We're going to use the latest Node.js LTS 8.x. Follow one of the following
31+
instructions depending on your operating system:
32+
33+
* [CentOS/Fedora/RHEL](https://github.com/nodesource/distributions#rpminstall)
34+
* [Debian/Ubuntu](https://github.com/nodesource/distributions#debinstall)
35+
* [macOS](https://nodejs.org/en/download/)
36+
* [Windows](https://nodejs.org/en/download/)
1937

2038
## Pre-requisites
2139

@@ -55,12 +73,12 @@ There are two reasons why we at HYF chose Node.js over others:
5573

5674
## Handing in homework
5775

58-
A Video to remind you about [how we hand in homework](https://www.youtube.com/watch?v=-o0yomUVVpU&index=2&list=PLVYDhqbgYpYUGxRdtQdYVE5Q8h3bt6SIA).
76+
Take a look at [this video](https://www.youtube.com/watch?v=-o0yomUVVpU)
77+
made by Daan, he explains how your homework needs to be handed in from now on.
5978

6079
Also review the [Git workflow material](https://github.com/HackYourFuture/Git/blob/master/Lecture-3.md)
6180
and use it as a reference.
6281

63-
6482
## Rewatch previous lectures
6583

6684
- Lecture 1 (Joost): https://www.youtube.com/watch?v=c8OvRVsbIsc

week0/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

week1/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HackYourFuture Node.js - Reading material week 1
1+
# HackYourFuture Node.js Week 1
22

33
## Agenda
44

@@ -7,19 +7,21 @@
77
3. Questions & answers (Q&A)
88
4. What is Node.js?
99
5. Finding documentation
10-
6. Setting up a Node.js project using `npm init` and `package.json`
11-
7. Installing dependencies using `npm install`
10+
6. Read-eval-print loop (REPL)
11+
7. Setting up a Node.js project using `npm init` and `package.json`
12+
8. Installing dependencies using `npm install`
1213
1. Local and global mode
13-
8. Importing modules using `require`
14+
9. Importing modules using `require`
1415
1. Built-in, external modules and local files
15-
9. Building an HTTP server using built-in `http` module
16+
10. Building an HTTP server using built-in `http` module
1617
1. HTTP request methods
1718
2. HTTP response status codes
18-
10. Homework
19+
3. Example
20+
11. Homework
1921

2022
## What is Node.js?
2123

22-
From Node.js' [website]()https://nodejs.org/en/:
24+
From Node.js' [website](https://nodejs.org/en/):
2325

2426
> Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
2527
> Node.js uses an event-driven, non-blocking I/O model that makes it lightweight
@@ -41,6 +43,10 @@ _estimated time: 4-6 hours_
4143

4244
[Node.js Documentation](https://nodejs.org/docs/latest-v8.x/api/documentation.html)
4345

46+
## Read-eval-print loop (REPL)
47+
48+
[REPL](https://nodejs.org/docs/latest-v8.x/api/repl.html)
49+
4450
## Setting up a Node.js project using `npm init` and `package.json`
4551

4652
[`npm init`](https://docs.npmjs.com/cli/init)
@@ -63,10 +69,6 @@ _estimated time: 4-6 hours_
6369

6470
[HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
6571

66-
## Homework
67-
68-
Check [README.md](homework/README.md) in `homework` subdirectory.
69-
7072
## Control flow and events
7173

7274
An important term when making applications is _control flow_. You already know
@@ -75,6 +77,10 @@ all about it. Read through this page and answer this question: how do we control
7577

7678
Read: [Examples of control flow in JavaScript](https://github.com/ummahusla/Codecademy-Exercise-Answers/tree/master/Language%20Skills/JavaScript/Unit%2005%20Control%20Flow/01%20More%20on%20Control%20Flow%20in%20JS)
7779

80+
## Homework
81+
82+
Check [README.md](homework/README.md) in `homework` subdirectory.
83+
7884
## Prepare for the next lecture
7985

8086
[Custom made playlist :boom: Lynda.com](https://www.lynda.com/SharedPlaylist/a034fd969ef945bb9ebbd9490cc75d5a)

week1/homework/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# HackYourFuture Node.js - Homework week 1
1+
# HackYourFuture Node.js Week 1 - Homework
22

3-
# Setup
3+
## Setup
44

55
Follow these instructions to set up your environment.
66

7-
## 1. Fork this repository and clone it to your hard drive
7+
### 1. Fork this repository and clone it to your hard drive
88

99
Follow the general homework instructions for this.
1010

11-
## 2. Install dependencies
11+
### 2. Install dependencies
1212

1313
Change to the directory where you've cloned this repository, then to
1414
`week1/homework` directory and finally install dependencies using `npm`.
@@ -19,7 +19,7 @@ cd week1/homework
1919
npm install
2020
```
2121

22-
## 3. Run the project from that directory
22+
### 3. Run the project from that directory
2323

2424
```bash
2525
node .

week2/README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
1-
# HackYourFuture Node.js - Reading material week 2
2-
3-
## Last weeks Summary
4-
5-
Last week we looked at building an HTTP interface. The interface allowed us to
6-
get a state, and manipulate the state (add, subtract, reset).
1+
# HackYourFuture Node.js Week 2
72

83
## Agenda
94

105
1. Recap last week
116
2. Previous homework
127
3. Questions & answers (Q&A)
138
4. Persisting data beyond the lifetime of the app
9+
1. Accessing file system using build-in `fs` module
10+
2. Example
1411
5. Building a command line interface (CLI)
15-
6. Accessing file system with Node.js `fs` module
16-
7. CRUD operations, create, read, update and delete
17-
8. Homework
12+
1. Accessing command line arguments using `process.argv`
13+
2. Example
14+
6. CRUD operations, create, read, update and delete
15+
7. Homework
1816

19-
## Reading material
17+
## Last week's summary
2018

21-
### Node.js process
19+
Last week we looked at building an HTTP server. That server allowed us to get a
20+
state and manipulate it (add, subtract, reset).
2221

23-
You don't have to remember everything in this video, just a nice outline
24-
[Egghead video tutorial](https://egghead.io/lessons/node-js-the-node-js-process-object)
25-
Only read the part about "process.argv"
26-
[Node.JS docs - process.argv](https://nodejs.org/docs/latest/api/process.html#process_process_argv)
22+
## Reading material
2723

2824
### Node.js file system module `fs`
2925

3026
[Main documentation](https://nodejs.org/docs/latest-v8.x/api/fs.html)
3127

3228
[fs.readFile()](https://nodejs.org/docs/latest-v8.x/api/fs.html#fs_fs_readfile_path_options_callback)
29+
3330
[fs.appendFile()](https://nodejs.org/docs/latest-v8.x/api/fs.html#fs_fs_appendfile_file_data_options_callback)
3431

32+
### Building a command line interface (CLI)
33+
34+
[Understand the Node.js process object](https://egghead.io/lessons/node-js-understand-the-node-js-process-object)
35+
You don't have to remember everything in this video, it's just a nice outline.
36+
37+
[Node.js Process Documentation](https://nodejs.org/docs/latest-v8.x/api/process.html)
38+
39+
[process.argv](https://nodejs.org/docs/latest-v8.x/api/process.html#process_process_argv)
40+
41+
### CRUD
42+
43+
[CRUD](https://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete)
44+
3545
### Node Fundamentals
3646

37-
Read parts:
38-
- 3.1, 3.2
39-
- 4.1, 4.3
40-
[Airpair tutorial](https://www.airpair.com/javascript/node-js-tutorial#3-node-fundamentals)
47+
Read parts 3.1, 3.2, 4.1, 4.3 of [Airpair tutorial](https://www.airpair.com/javascript/node-js-tutorial#3-node-fundamentals)
48+
49+
## Homework
50+
51+
Check [README.md](homework/README.md) in `homework` subdirectory.
4152

4253
## Prepare for the next lecture
4354

week2/homework/.eslintrc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true
5+
},
6+
"extends": "standard",
7+
"rules": {
8+
"brace-style": [
9+
"warn",
10+
"stroustrup",
11+
{
12+
"allowSingleLine": true
13+
}
14+
],
15+
"curly": [
16+
"off"
17+
],
18+
"generator-star-spacing": [
19+
"warn",
20+
{
21+
"after": true,
22+
"before": false
23+
}
24+
],
25+
"key-spacing": [
26+
"off"
27+
],
28+
"max-len": [
29+
"warn",
30+
80
31+
],
32+
"no-multi-spaces": [
33+
"off"
34+
],
35+
"semi": [
36+
"error",
37+
"always"
38+
],
39+
"space-before-function-paren": [
40+
"warn",
41+
"never"
42+
],
43+
"standard/array-bracket-even-spacing": [
44+
"off"
45+
],
46+
"standard/object-curly-even-spacing": [
47+
"off"
48+
],
49+
"template-tag-spacing": [
50+
"off"
51+
]
52+
}
53+
}

week2/homework/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

week2/homework/README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
# HackYourFuture Node.js - Homework week 2
1+
# HackYourFuture Node.js Week 2 - Homework
22

3-
## Assignment for this week
3+
## Assignment
44

55
These are the specs for this week's assignment:
66

7-
- The user can run a Node.js to-do app
8-
- The user must be able to run the file using `node index.js`
9-
- There should be a "help" section that lists all the commands for how to use
10-
the app
7+
- Write a Node.js command line application
8+
- The user must be able to run the file using `node index.js` or `node .` in the
9+
project directory
10+
- There must be a `help` section that lists all the commands and a short
11+
description for each of them
12+
- The user must be able to add, remove and list to-dos.
13+
- The user must be able to remove all to-dos at once.
1114

12-
The following commands should be present:
15+
The following commands must be present:
1316

1417
### No command or `help`
1518

@@ -58,15 +61,22 @@ Removes all to-do items from the list:
5861
node index.js reset
5962
```
6063

61-
### *BONUS:* `update`
64+
## Bonus assignment
65+
66+
- Use JSON to store to-dos and add following commands
67+
- Split each action (i.e. read, write, etc.) into a separate file
68+
- Use [commander](https://www.npmjs.com/package/commander) library to implement
69+
command line interface
70+
71+
### `update`
6272

6373
Updates a to-do item with new text:
6474

6575
```
66-
node index.js update 3 "Wash teeth"
76+
node index.js update 3 "Brush teeth"
6777
```
6878

6979
### Things to consider
7080

71-
- What representation you use in your file (CSV, TSV, JSON, ...)
81+
- What representation you use in your file (CSV, TSV, JSON, etc).
7282
- Handle edge cases, i.e. control what happens if user enters unexpected input

0 commit comments

Comments
 (0)