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

Skip to content

Commit a68a065

Browse files
committed
Updated Week 1 homework
1 parent 7eb5d1b commit a68a065

File tree

3 files changed

+51
-36
lines changed

3 files changed

+51
-36
lines changed

week0/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Watch before your first Node.js session
22

33
- Go through the [README.md](https://github.com/HackYourFuture/Node.js) of this
4-
repo
4+
repository
55
- Watch Jason's playlist on [Lynda.com]
66
(https://www.lynda.com/SharedPlaylist/a850f6b7bddf437f8b98679f5f9d9cc3) (45 min)
77

@@ -16,7 +16,7 @@ and use it as a reference.
1616
## Node.js Setup
1717

1818
We're going to use latest Node.js LTS 8.x. Follow one of the following
19-
instructions dependending on your operating system:
19+
instructions depending on your operating system:
2020

2121
* [CentOS/Fedora/RHEL](https://github.com/nodesource/distributions#rpminstall)
2222
* [Debian/Ubuntu](https://github.com/nodesource/distributions#debinstall)

week1/MAKEME.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Assignment
44

55
Create an http server that can add and subtract from a number, which we will
6-
call the "state". Please see in `index.js` in this folder as starting material.
6+
call `state`. Use project in `week1` directory as starting material.
77
Pay extra attention to line 21, which contains some hints for this week
88
`console.log('New http request received', request.url);`
99

@@ -17,37 +17,42 @@ You can use other packages, but you _must_ also make a version _without_ any npm
1717
packages. `http`, of course, is a built-in Node.js package, so you can use that.
1818

1919
```js
20-
// The state
20+
// The state variable
2121
let state = 10;
2222
```
2323

24-
Endpoints criteria
24+
## Endpoints criteria
2525

2626
```js
27-
// /state
28-
// response: the current state in a html format
29-
// when the server starts, this should return "10"
30-
http://localhost:8080/state
31-
32-
// /add
33-
// Response: "ok" in html format
34-
// This should add 1 to the current state
35-
http://localhost:8080/add
36-
37-
// /remove
38-
// Response: "ok" in html format
39-
// This should subtract 1 ƒrom the current state
40-
http://localhost:8080/remove
41-
42-
// /reset
43-
// Response: "ok" in html format
44-
// This should set the state back to 10
45-
http://localhost:8080/reset
46-
47-
// Any other URL
48-
// Response: return error code 404: Not found with a friendly message
49-
// and do not change the state variable
50-
http://localhost:8080/subtract
27+
/* /state
28+
* response: the current state in a HTML format
29+
* When the server starts, this should return '10'
30+
*/
31+
const stateUrl = 'http://localhost:8080/state';
32+
33+
/* /add
34+
* Response: "OK" in HTML format
35+
* This should add 1 to the current state
36+
*/
37+
const addUrl = 'http://localhost:8080/add';
38+
39+
/* /subtract
40+
* Response: "OK" in HTML format
41+
* This should subtract 1 ƒrom the current state
42+
*/
43+
const subtractUrl = 'http://localhost:8080/subtract';
44+
45+
/* /reset
46+
* Response: "OK" in HTML format
47+
* This should set the state back to '10'
48+
*/
49+
const resetUrl = 'http://localhost:8080/reset';
50+
51+
/* Any other URL
52+
* Response: return error code 404: 'Not found' with a friendly message and do
53+
* not change the state variable
54+
*/
55+
const badUrl = 'http://localhost:8080/bad';
5156
```
5257

5358
## Reading
@@ -69,4 +74,5 @@ Read: http://openmymind.net/2012/2/3/Node-Require-and-Exports/
6974
- Read Advanced:
7075

7176
While not strictly homework, we’ve created another playlist if you’d like to
72-
learn more or review (and as JavaScript developers, you should) https://www.lynda.com/SharedPlaylist/78e6513f51bb4102b03349460491b4e3
77+
learn more or review (and as JavaScript developers, you should)
78+
https://www.lynda.com/SharedPlaylist/78e6513f51bb4102b03349460491b4e3

week1/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
# HackYourFuture Node.js - Reading material week 1
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."
3+
"What it really means is that Node.js is not a silver-bullet new platform that
4+
will dominate the web development world. Instead, it’s a platform that fills a
5+
particular need."
46

57
### What is Node.js?
68

7-
[What is Node.js? 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_
9+
[What is Node.js? 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)
10+
_estimated time: 10 minutes_
811

912
### Getting started with Node.js and npm
1013

11-
Tutorials: [NPM tutorials. Follow chapters 1 - 10](https://docs.npmjs.com/getting-started/installing-node) _estimated time: 4-6 hours_
14+
Tutorials: [NPM tutorials. Follow chapters 1 - 10](https://docs.npmjs.com/getting-started/installing-node)
15+
_estimated time: 4-6 hours_
1216

1317
### Asynchronous callbacks
1418

15-
Although most of this was already covered by the JavaScript class, let's refresh our memories on Callbacks.
19+
Although most of this was already covered by the JavaScript class, let's refresh
20+
our memories on Callbacks.
21+
1622
Read: [Understanding Asynchronous JavaScript Callbacks Through Household Chores
17-
](https://medium.freecodecamp.com/understanding-asynchronous-javascript-callbacks-through-household-chores-e3de9a1dbd04#.8ilr4a7aj) _estimated time: ~1 hour_
23+
](https://medium.freecodecamp.com/understanding-asynchronous-javascript-callbacks-through-household-chores-e3de9a1dbd04#.8ilr4a7aj)
24+
_estimated time: ~1 hour_
1825

1926
### Control flow and events
2027

21-
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?
28+
An important term when making applications is _control flow_. You already know
29+
all about it. Read through this page and answer this question: how do we control
30+
"flow" in JavaScript?
2231

2332
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)
2433

0 commit comments

Comments
 (0)