Skip to content

Commit 6bfbaeb

Browse files
committed
Changed some wording on http lab
1 parent 3ed06f1 commit 6bfbaeb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_posts/2012-11-3-http.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var server = http.createServer(function (req, res) {
2727
});
2828
{% endhighlight %}
2929

30-
The callback function `function (req, res) {}` passed into the `createServer` call will be called when every request comes in. It is passed two arguments, the request (readable stream) and the response (writable stream).
30+
The callback function `function (req, res) {}` passed into the `createServer` call will be invoked with every new request to our server. This callback is passed two arguments, the request (a readable stream) and the response (a writable stream).
3131

3232
Our new server is not yet bound to any port, and therefore cannot accept incoming connections. In order to bind to a port, call the `server.listen(port)` function.
3333

@@ -47,9 +47,9 @@ Let's boot up our server and take a look. Run the script:
4747
$ node server.js
4848
{% endhighlight %}
4949

50-
Now, open your browser and navigate to [http://localhost:8080](http://localhost:8080). You will notice that your browser seems to hang and will eventually timeout. This is because our server is not yet doing anything useful with the incoming connection (in fact, it's the `// TODO` line).
50+
Now, open your browser and navigate to [http://localhost:8080](http://localhost:8080). You will notice that your browser seems to hang and will eventually timeout. This is because our server is not yet doing anything useful with the incoming connection.
5151

52-
Let's start by responding to all requests with a 200 status code.
52+
Let's start by responding to all requests with a 200 status code. This is HTTP speak for everything is OK.
5353

5454
{% highlight javascript %}
5555
var http = require('http');
@@ -147,7 +147,7 @@ var templateEngine = function (template, data) {
147147
};
148148
{% endhighlight %}
149149

150-
`templateEngine` takes a template string and a data object and searches for the pattern `{variableName}` and replaces matches with `data.variableName`. Feel free to copy/paste this code unless you want extra practice writing JavaScript.
150+
`templateEngine` takes a template string and a data object and searches for the pattern `{variableName}` and replaces matches with `data.variableName`. Feel free to copy/paste this code unless you want extra practice writing JavaScript and regular expressions.
151151

152152
Let's use this simple template engine to parse the content of our `index.html` file.
153153

0 commit comments

Comments
 (0)