Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
timotew committed Jan 21, 2018
1 parent bf4e20f commit 47cf571
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions doc/api/synopsis.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ An example of a [web server][] written with Node.js which responds with

Commands displayed in this document are shown starting with `$` or `>`
to replicate how they would appear in a user's terminal.
Do not include the `$` and `>` character.
They are there to indicate the start of each command.
Do not include the `$` and `>` character they are there to
indicate the start of each command.

There are many tutorials and examples that follow this
convention: `$` or `>` for commands run as a regular user, and `#`
Expand All @@ -24,22 +24,22 @@ for commands that should be executed as an administrator.
Lines that don’t start with `$` or `>` character are typically showing
the output of the previous command.

Firstly, make sure to have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download).

To install Node using a package manager, see [this guide](https://nodejs.org/en/download/package-manager/).

Firstly, make sure to have downloaded and installed Node.js.
See [this guide][] for further install information.

Now, create an empty project folder called `projects`, navigate into it:
Project folder can be named base on user's current project title but
this example will use `projects` as the project folder.

UNIX :
Linux and Mac:

```console
$ mkdir ~/projects
$ cd ~/projects
```

Windows CMD:

```console
> mkdir %USERPROFILE%\projects
> cd %USERPROFILE%\projects
Expand All @@ -55,17 +55,12 @@ Windows PowerShell:
Next, create a new source file in the `projects` folder
and call it `hello-world.js`.

If filename has more than one word, use a hyphen(`-`) or
an underscore(`_`) to separate them for simplicity and avoid using
the space character in file names.

For example, use `hello-world.js` rather than `hello world.js`.
Node.js files always end with the `.js` extension.
In Node.js it is considered good style to use hyphens (`-`) or underscores (`_`) to separate
multiple words in filenames.

Open `hello-world.js` in any preferred text editor and paste in the following
content.


```js
const http = require('http');

Expand All @@ -82,16 +77,20 @@ server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
```

Save the file, go back to the terminal window enter the following command:

```console
$ node hello-world.js
```
an output like this should appear in the terminal to indicate Node.js

An output like this should appear in the terminal to indicate Node.js
server is running:

```console
Server running at http://127.0.0.1:3000/
````
Now, open any preferred web browser and visit `http://127.0.0.1:3000`.
If the browser displays the string `Hello, world!`, that indicates
Expand All @@ -101,3 +100,5 @@ Many of the examples in the documentation can be run similarly.

[Command Line Options]: cli.html#cli_command_line_options
[web server]: http.html
[this guide]: https://nodejs.org/en/download/package-manager/
[Node.js Official website]: http://nodejs.org/#download

0 comments on commit 47cf571

Please sign in to comment.