doc: improve synopsis.md

Many small improvements to synopsis.md to make it more concise, more
clear, and more correct (punctuation, etc.).

PR-URL: https://github.com/nodejs/node/pull/28115
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Rich Trott 2019-06-06 19:48:16 -07:00
parent 0059b877e3
commit 7105bbc710

View File

@ -5,31 +5,23 @@
`node [options] [V8 options] [script.js | -e "script" | - ] [arguments]` `node [options] [V8 options] [script.js | -e "script" | - ] [arguments]`
Please see the [Command Line Options][] document for information about Please see the [Command Line Options][] document for more information.
different options and ways to run scripts with Node.js.
## Example ## Example
An example of a [web server][] written with Node.js which responds with An example of a [web server][] written with Node.js which responds with
`'Hello, World!'`: `'Hello, World!'`:
Commands displayed in this document are shown starting with `$` or `>` Commands in this document start with `$` or `>` to replicate how they would
to replicate how they would appear in a user's terminal. appear in a user's terminal. Do not include the `$` and `>` characters. They are
Do not include the `$` and `>` characters. They are there to there to show the start of each command.
indicate the start of each command.
There are many tutorials and examples that follow this Lines that dont start with `$` or `>` character show the output of the previous
convention: `$` or `>` for commands run as a regular user, and `#` command.
for commands that should be executed as an administrator.
Lines that dont start with `$` or `>` character are typically showing First, make sure to have downloaded and installed Node.js. See [this guide][]
the output of the previous command. for further install information.
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`, then navigate into it. Now, create an empty project folder called `projects`, then navigate into it.
The project folder can be named based on the user's current project title, but
this example will use `projects` as the project folder.
Linux and Mac: Linux and Mac:
@ -75,14 +67,13 @@ server.listen(port, hostname, () => {
}); });
``` ```
Save the file, go back to the terminal window enter the following command: Save the file, go back to the terminal window, and enter the following command:
```console ```console
$ node hello-world.js $ node hello-world.js
``` ```
An output like this should appear in the terminal to indicate Node.js Output like this should appear in the terminal:
server is running:
```console ```console
Server running at http://127.0.0.1:3000/ Server running at http://127.0.0.1:3000/
@ -93,8 +84,6 @@ Now, open any preferred web browser and visit `http://127.0.0.1:3000`.
If the browser displays the string `Hello, World!`, that indicates If the browser displays the string `Hello, World!`, that indicates
the server is working. the server is working.
Many of the examples in the documentation can be run similarly.
[Command Line Options]: cli.html#cli_command_line_options [Command Line Options]: cli.html#cli_command_line_options
[this guide]: https://nodejs.org/en/download/package-manager/ [this guide]: https://nodejs.org/en/download/package-manager/
[web server]: http.html [web server]: http.html