@@ -114,9 +114,9 @@ $ node
114114$
115115```
116116
117- {{index "process object", "global scope", [ variable , global] , "exit method", "status code"}}
117+ {{index "process object", "global scope", [ binding , global] , "exit method", "status code"}}
118118
119- The ` process ` variable , just like the ` console ` variable , is available
119+ The ` process ` binding , just like the ` console ` binding , is available
120120globally in Node. It provides various ways to inspect and manipulate
121121the current program. The ` exit ` method ends the process and can be
122122given an exit status code, which tells the program that started ` node `
@@ -136,9 +136,9 @@ $ node showargv.js one --and two
136136["node", "/tmp/showargv.js", "one", "--and", "two"]
137137```
138138
139- {{index [ variable , global] }}
139+ {{index [ binding , global] }}
140140
141- All the ((standard)) JavaScript global variables , such as ` Array ` ,
141+ All the ((standard)) JavaScript global bindings , such as ` Array ` ,
142142` Math ` , and ` JSON ` , are also present in Node's environment.
143143Browser-related functionality, such as ` document ` and ` prompt ` , is
144144absent.
@@ -147,7 +147,7 @@ absent.
147147
148148{{index "Node.js", "global scope", "module loader"}}
149149
150- Beyond the few variables I mentioned, such as ` console ` and ` process ` ,
150+ Beyond the few bindings I mentioned, such as ` console ` and ` process ` ,
151151Node puts little functionality in the global scope. If you want to
152152access built-in functionality, you have to ask the module system for
153153it.
@@ -501,7 +501,7 @@ request to your server. It will respond with a small HTML page.
501501
502502The function passed as argument to ` createServer ` is called every time
503503a client connects to the server. The ` request ` and ` response `
504- variables are objects representing the incoming and outgoing data. The
504+ bindings are objects representing the incoming and outgoing data. The
505505first contains information about the ((request)), such as its ` url `
506506property, which tells us to what URL the request was made.
507507
@@ -622,8 +622,8 @@ one piece at a time, rather than in one shot as with `writeFile`.
622622{{index "createServer function", "request function", "event handling", "readable stream"}}
623623
624624Readable ((stream))s are a little more involved. Both the ` request `
625- variable that was passed to the HTTP server's callback function and
626- the ` response ` variable passed to the HTTP client are readable
625+ binding that was passed to the HTTP server's callback function and
626+ the ` response ` binding passed to the HTTP client are readable
627627streams. (A server reads requests and then writes responses, whereas a
628628client first writes a request and then reads a response.) Reading from
629629a stream is done using event handlers, rather than methods.
@@ -661,7 +661,7 @@ createServer((request, response) => {
661661
662662{{index "Buffer class", "toString method"}}
663663
664- The ` chunk ` variable passed to the data handler will be a binary
664+ The ` chunk ` value passed to the data handler will be a binary
665665` Buffer ` . We can convert this to string by decoding it as UTF-8
666666encoded characters with its ` toString ` method..
667667
@@ -791,13 +791,13 @@ decodes that to get rid of the `%20`-style escape codes, and resolves
791791it relative to the program's working directory.
792792
793793``` {includeCode: ">code/file_server.js"}
794- const {parse: parseURL } = require("url");
794+ const {parse} = require("url");
795795const {resolve} = require("path");
796796
797797const baseDirectory = process.cwd() + "/";
798798
799799function urlPath(url) {
800- let {pathname} = parseURL (url);
800+ let {pathname} = parse (url);
801801 let path = resolve(decodeURIComponent(pathname).slice(1));
802802 if (!path.startsWith(baseDirectory)) {
803803 throw {status: 403, body: "Forbidden"};
0 commit comments