Skip to content

Commit

Permalink
Explaination for npm-init-y (#624)
Browse files Browse the repository at this point in the history
* Explaination for npm-init-y

* removing Pause and extra lines from the file
  • Loading branch information
pydevsg authored and alodahl committed Mar 5, 2019
1 parent 41fa6f1 commit 891d551
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Binary file added node-js/images/npm-init-y-msg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 5 additions & 11 deletions node-js/node-lab-exercise-part-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ Open the `app.js` file again. Replace the print statement with a function that p

If nothing printed to the Terminal, you are missing something in your `app.js` file. Once `app.js` prints something to the Terminal, obtain a code review.

> **PAUSE.** Obtain a code review from Techtonica staff by pinging and sending them a screenshot of your console and contents of your app.js file.
-----

#### Part 2 - Use npm to create a `package.json` file
Expand All @@ -91,11 +89,13 @@ Once successful, you'll see a JSON object printed to your Terminal.

![npm json](/node-js/images/npm-json.png?raw=true)

**Second step**
While in your `getting-started-with-node` folder, running the `ls` command should reveal that a new `package.json` file has been added to the folder. Open `package.json` in your text editor and see what's inside the file. It should be the same as the JSON that was printed to your Terminal in Step 1.
Another way to create a `package.json` file is using `npm init -y`

> **PAUSE.** Obtain a code review from Techtonica staff by pinging and sending them a screenshot of your console and contents of your app.js file or by sharing your code with another apprentice and verifying that your code runs and the contents of your files are similar.
The -y flag when passed to npm commands tells the generator to use the defaults instead of asking questions.
![Message from npm init command](/node-js/images/npm-init-y-msg.png?raw=true)

**Second step**
While in your `getting-started-with-node` folder, running the `ls` command should reveal that a new `package.json` file has been added to the folder. Open `package.json` in your text editor and see what's inside the file. It should be the same as the JSON that was printed to your Terminal in Step 1.

-----

Expand Down Expand Up @@ -160,8 +160,6 @@ There's one last thing we need to check. Remember that our server instance is su

In the Terminal, press < CONTROL > + C to shut down the server. We'll boot it up again later.

> **PAUSE.** Obtain an online code review from Techtonica staff.
-----

#### Part 4 - Serve an HTML file with Node.js
Expand Down Expand Up @@ -237,8 +235,6 @@ fs.readFile('index.html', (err, html) => {
```
Save the file.

> **PAUSE.** Obtain an online code review from Techtonica staff.
-----

**Third Step**
Expand All @@ -261,8 +257,6 @@ Re-start the server in the Terminal by running `node app.js` from within the `ge

Next, open a new tab in Chrome and navigate to http://localhost:3000. You should see the `index.html` in all its rendered glory! Also note that the text that appears in the tab's title matches what you specified inside the `<title>` tags in `index.html`.

> **PAUSE.** Obtain an online code review from Techtonica staff.
-----

### Questions to Consider
Expand Down

0 comments on commit 891d551

Please sign in to comment.