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

Skip to content

Commit fe470da

Browse files
committed
Updated homework + reading material week1
1 parent 2633a0c commit fe470da

File tree

7 files changed

+154
-135
lines changed

7 files changed

+154
-135
lines changed

README.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
# nodejs
2-
NodeJS 101 course
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
32
4-
## Pre-requisites
5-
6-
### Bash Shell
7-
8-
Much of the course will be done on the command line so it's important to be familiar with it. We will use the BASH shell. If you are running OSX or Linux then you already have this. If you are on Windows then these are your options:
9-
10-
* Built in Windows 10 Bash shell. If you have the latest Windows 10 anniversary update you can activate a native Bash shell. I haven't tried this myself yet. If it works well it should be the best option. See instructions here: [How to Install and Use the Linux Bash Shell on Windows 10](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/)
11-
12-
* Git Bash. This comes with Git for windows and should already be installed if you have installed Git. If not you can re-install git and make sure it is selected. [Git for windows](https://git-scm.com/download/win)
13-
14-
* Cygwin. Cygwin is like installing a virtual Linux on your PC. Very powerful, with many options, but not the best choice if you don't like spending time configuring things. [Cygwin project](https://www.cygwin.com/)
3+
# HackYourFuture - Node.js
4+
This 3 week HYF Module is about Node.JS. We can think of Node.JS as "Javascript not running in a browser". This is what we mean by "backend", as in "backend developer".
155

16-
Please look at this tutorial to help you get up to speed with using the command line: [Digital Ocean - getting started with Linux](https://www.digitalocean.com/community/tutorial_series/getting-started-with-linux)
6+
## Planning
7+
| Week | Topic | Read | Homework |
8+
| ---- | ----- | ---- | -------- |
9+
| 1. | Node.js, NPM, http | [Week 1 Reading](week1/README.md) | [Week 1 Homework](week1/MAKEME.md) |
10+
| 2. | fs, process | [Week 2 Reading](week2/README.md) | [Week 2 Homework](week2/MAKEME.md) |
11+
| 3. | express, REST | [Week 3 Reading](week3/README.md) | [Week 3 Homework](week3/MAKEME.md) |
1712

18-
### Git
1913

20-
Git is required to upload your homework. You will need:
21-
22-
* A github account. Sign up here [GitHub](https://github.com)
23-
24-
* Git installed on your laptop All installers are here: [Git SCM](https://git-scm.com/downloads). If you are running Linux you can also install by using the package manager of your distribution.
25-
26-
* A working knowledge of using git. Here is a short tutorial [Digital Ocean Git tutorial](https://www.digitalocean.com/community/tutorials/how-to-use-git-effectively). Here is a cheat sheet. Print out and keep next to you :-) [Git cheat sheet](https://services.github.com/kit/downloads/github-git-cheat-sheet.pdf). If you want to deep dive you can get this free book [Pro-Git](https://progit2.s3.amazonaws.com/en/2016-03-22-f3531/progit-en.1084.pdf).
27-
28-
### Node.js
29-
30-
Obviously you need Node.js installed to use :-) The installer for your OS can be downloaded from their website [Node.js](https://nodejs.org). If you are running Linux you can also install by using the package manager of your distribution. Please install the 'Current' version 6.6.
14+
## Pre-requisites
15+
We will build on knowledge from the following HYF (sub)modules. If we feel we have gaps we should review the curriculum ourselves or ask a teacher to help.
16+
- [JavaScript](https://github.com/HackYourFuture/JavaScript)
17+
- [Git](https://github.com/HackYourFuture/Git)
18+
- [Bash/CommandLineInterface](https://github.com/HackYourFuture/CommandLine)
19+
20+
## What will we learn?
21+
- What is Node.js?
22+
- Using Node Package Manager (NPM)
23+
- Using `require` to include modules
24+
- Using `http` to handle http requests and respond
25+
- Using `fs` to read from and write to files.
26+
- Using `process` to read arguments from the CLI
27+
- Using `express` to make a RESTful API
28+
29+
## Why Node.js?
30+
For almost any web application, it is essential to have a backend. The backend is a place where we, the developers, can store our data, communicate with users and let the users communicate with us, do smart things like calculations, data processing etc.
31+
32+
There are many languages for this. We might've heard of Java, C, C++, Go, Python, Ruby, PHP and the [list goes on](https://blog.newrelic.com/2016/08/18/popular-programming-languages-2016-go/).
33+
34+
There are two reasons why we at HYF choose Node.JS over others:
35+
1) You already know JavaScript, so it's easier to get started than other languages
36+
2) Node.js is great for making web APIs because it is asynchronous by nature and thus allows for high input/output. By this we mean that it allows many users to make very light requests at the same time.

week1/MAKEME.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
2+
3+
# HackYourFuture Node.js - Homework week 1
4+
5+
## Assignment:
6+
Create an http server that can add and subtract from a number, which we will call the "state". Please see in `index.js` in this folder as starting material. Pay extra attention to line 21, which contains some hints for this week `console.log('New http request received', request.url);`
7+
8+
Rule 1: DO NOT USE EXPRESS.JS
9+
Rule 2: you can use other packages, but you HAVE to also make a version WITHOUT any NPM packages (http, of course, is not NPM but a node native package)
10+
```
11+
// The state
12+
var state = 10;
13+
```
14+
15+
Endpoints criteria
16+
```
17+
// /state
18+
// response: the current state in a html format
19+
// when the server starts, this should return "10"
20+
http://localhost:8080/state
21+
22+
// /add
23+
// Response: "ok" in html format
24+
// This should add 1 to the current state
25+
http://localhost:8080/add
26+
27+
// /remove
28+
// Response: "ok" in html format
29+
// This should subtract 1 ƒrom the current state
30+
http://localhost:8080/remove
31+
32+
// /reset
33+
// Response: "ok" in html format
34+
// This should set the state back to 10
35+
http://localhost:8080/reset
36+
37+
// Any other URL
38+
// Response: return error code 404: Not found with a friendly message
39+
// and do not change the state variable
40+
http://localhost:8080/subtract
41+
```
42+
43+
## Reading
44+
### Callbacks:
45+
Video: https://www.youtube.com/watch?v=pTbSfCT42_M
46+
Read: http://callbackhell.com/
47+
48+
### Require/exporting
49+
Video: https://www.youtube.com/watch?v=e1Ln1FrLvh8
50+
Read: http://openmymind.net/2012/2/3/Node-Require-and-Exports/
51+
52+
### http, http listen
53+
- Video basic: https://www.youtube.com/watch?v=pYOltVz7kL0
54+
- Video routing: https://www.youtube.com/watch?v=_D2w0voFlEk (please focus on request.url, not request.method)
55+
- Read: [Node JS documentation about http](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/)
56+
- Read Advanced:
57+
58+
refresh on command line
59+
Video Mac/linux:
60+
Video PC: -- ()

week1/README.md

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,20 @@
1-
# Week 1 outline
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
22
3-
"What it really means is that Node.js is not a silver-bullet new platform that will dominate the web development world. Instead, it’s a platform that fills a particular need."
4-
5-
1. Setting up: node, git, bash, npm, (See https://github.com/HackYourFuture/Node.js/blob/master/README.md)
6-
2. Introduction to nodejs
7-
https://www.tutorialspoint.com/nodejs/nodejs_introduction.htm
8-
http://blog.modulus.io/absolute-beginners-guide-to-nodejs
9-
https://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js
10-
https://airpair-blog.s3.amazonaws.com/wp-content/uploads/2014/08/node.png
11-
12-
3. Nodejs in the MEAN stack (clients and servers)
13-
http://image.slidesharecdn.com/mongodbdayspresentation-151014213733-lva1-app6892/95/starting-from-scratch-with-the-mean-stack-22-638.jpg?cb=1444858819
14-
4. Asynchronous callbacks
15-
5. HTTP server
16-
6. Localhost
17-
7. Error codes http://www.restapitutorial.com/httpstatuscodes.html
18-
8. npm
19-
9. The assignment
20-
21-
This week's homework
22-
23-
## Assignment:
24-
Create a http server that can add and subtract from a number, which we will call the "state". Please see in `index.js` in this folder as starting material. Pay extra attention to line 21, which contains some hints for this week `console.log('New http request received', request.url);`
25-
26-
Rule 1: DO NOT USE EXPRESS.JS
27-
Rule 2: you can use other packages, but you HAVE to also make a version WITHOUT any NPM packages (http, of course, is not NPM but a node native package)
28-
```
29-
// The state
30-
var state = 10;
31-
```
3+
# HackYourFuture Node.js - Reading material week 1
324

33-
Endpoints criteria
34-
```
35-
// /state
36-
// response: the current state in a html format
37-
// when the server starts, this should return "10"
38-
http://localhost:8080/state
39-
40-
// /add
41-
// Response: "ok" in html format
42-
// This should add 1 to the current state
43-
http://localhost:8080/add
44-
45-
// /remove
46-
// Response: "ok" in html format
47-
// This should subtract 1 ƒrom the current state
48-
http://localhost:8080/remove
49-
50-
// /reset
51-
// Response: "ok" in html format
52-
// This should set the state back to 10
53-
http://localhost:8080/reset
54-
55-
// Any other URL
56-
// Response: return error code 404: Not found with a friendly message
57-
// and do not change the state variable
58-
http://localhost:8080/subtract
59-
```
5+
"What it really means is that Node.js is not a silver-bullet new platform that will dominate the web development world. Instead, it’s a platform that fills a particular need."
606

61-
## Reading
62-
### Callbacks:
63-
Video: https://www.youtube.com/watch?v=pTbSfCT42_M
64-
Read: http://callbackhell.com/
7+
### What is Node.js?
8+
> Read: [What is NodeJS? What can you do with it? Why should you use it?](https://medium.com/@paynoattn/what-is-nodejs-what-can-you-do-with-it-why-should-you-use-it-8c8d6df32d6d#.qvbp8g4dq) _estimated time: 10 minutes_
659
66-
### Require/exporting
67-
Video: https://www.youtube.com/watch?v=e1Ln1FrLvh8
68-
Read: http://openmymind.net/2012/2/3/Node-Require-and-Exports/
10+
### Getting started with Node.js and npm
11+
> Tutorials: [NPM tutorials. Follow chapters 1 - 10](https://docs.npmjs.com/getting-started/installing-node) _estimated time: 4-6 hours_
6912
70-
### http, http listen
71-
- Video basic: https://www.youtube.com/watch?v=pYOltVz7kL0
72-
- Video routing: https://www.youtube.com/watch?v=_D2w0voFlEk (please focus on request.url, not request.method)
73-
- Read: [Node JS documentation about http](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/)
74-
- Read Advanced:
13+
### Asynchronous callbacks
14+
Although most of this was already covered by the JavaScript class, let's refresh our memories on Callbacks.
15+
> Read: [Understanding Asynchronous JavaScript Callbacks Through Household Chores
16+
](https://medium.freecodecamp.com/understanding-asynchronous-javascript-callbacks-through-household-chores-e3de9a1dbd04#.8ilr4a7aj) _estimated time: ~1 hour_
7517

76-
refresh on command line
77-
Video Mac/linux:
78-
Video PC: -- ()
18+
### Control flow and events
19+
An important term when making applications is _control flow_. You already know all about it. Read through this page and answer this question: how do we control "flow" in JavaScript?
20+
> 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)

week2/MAKEME.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
2+
3+
# HackYourFuture Node.js - Homework week 2
4+
5+
## Assignment for this week
6+
These are the specs for this week's assignment:
7+
- The user can run a NodeJs to-do app
8+
- The user can 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 the app
10+
11+
The following commands should be present:
12+
- No command: show help section (`node index.js`)
13+
- help: show help section (`node index.js help`)
14+
- list: show current todo's, or show an appropriate text if there are no todos (`node index.js list`)
15+
- add: add a todo item. all the words behind "add" are entered as 1 todo item to the list (`node index.js add "Buy groceries"`)
16+
- remove: remove a todo item by its 1-base index. (`node index.js remove 2`)
17+
- reset: remove all todo items from the list (`node index.js reset`)
18+
19+
- *BONUS:* update: update a todo item with new text (`node index.js update 3 "Wash teeth"`)
20+
21+
### Consider this:
22+
- What representation you use in your file (CSV, TSV, JSON, ...)
23+
- Handle edge cases, i.e. control what happens if user enters unexpected input

week2/README.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## Last week Summary
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
2+
3+
# HackYourFuture Node.js - Reading material week 2
4+
5+
## Last weeks Summary
26
Last week we looked at building an HTTP interface. The interface allowed us to get a state, and manipulate the state (add, subtract, reset).
37

48
## Today's meal
@@ -12,26 +16,6 @@ Last week we looked at building an HTTP interface. The interface allowed us to g
1216
7. CRUD operations
1317
8. This week's assignment
1418

15-
## Assignment for this week
16-
These are the specs for this week's assignment:
17-
- The user can run a NodeJs to-do app
18-
- The user can be able to run the file using node index.js
19-
- There should be a "help" section that lists all the commands for how to use the app
20-
21-
The following commands should be present:
22-
- No command: show help section (`node index.js`)
23-
- help: show help section (`node index.js help`)
24-
- list: show current todo's, or show an appropriate text if there are no todos (`node index.js list`)
25-
- add: add a todo item. all the words behind "add" are entered as 1 todo item to the list (`node index.js add "Buy groceries"`)
26-
- remove: remove a todo item by its 1-base index. (`node index.js remove 2`)
27-
- reset: remove all todo items from the list (`node index.js reset`)
28-
29-
- *BONUS:* update: update a todo item with new text (`node index.js update 3 "Wash teeth"`)
30-
31-
### Consider this:
32-
- What representation you use in your file (CSV, TSV, JSON, ...)
33-
- Handle edge cases, i.e. control what happens if user enters unexpected input
34-
3519
## Reading material
3620

3721
### Something about ES6 I want you guys to know

week3/MAKEME.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
2+
3+
# HackYourFuture Node.js - Homework week 3
4+
5+
### Assignment for this weak:
6+
Create Node JS server that
7+
8+
- Listens on port 8080
9+
10+
- Allows users to list todos, get a todo, delete a todo, delet all todos, and update a todo.
11+
12+
Some other notes:
13+
- All responses should be in JSON.
14+
- Follow the REST design principles: Use the proper method, response status codes, and consistent URL paths.
15+
- Try to apply the MVC model to your file structure. It will save you time in following assignments!
16+
- Test your API using Postman.
17+
- There is a commented out example to start with in my `index.js`
18+

week3/README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Node JS Class
1+
> Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
22
3+
# HackYourFuture Node.js - Reading material week 3
34

45
### Todays' Meal
56

@@ -13,19 +14,4 @@
1314
9. Express vs native http library
1415
6. Building a REST web API for Todos
1516

16-
### Assignment for this weak:
17-
Create Node JS server that
18-
19-
- Listens on port 8080
20-
21-
- Allows users to list todos, get a todo, delete a todo, delet all todos, and update a todo.
22-
23-
Some other notes:
24-
- All responses should be in JSON.
25-
- Follow the REST design principles: Use the proper method, response status codes, and consistent URL paths.
26-
- Try to apply the MVC model to your file structure. It will save you time in following assignments!
27-
- Test your API using Postman.
28-
- There is a commented out example to start with in my `index.js`
29-
30-
3117

0 commit comments

Comments
 (0)