You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,15 +13,15 @@ This tutorial will walk you through the creation of a very basic website using o
13
13
5. Create a new file called app.js.
14
14
6. In app.js import the required modules:
15
15
16
-
```
16
+
```js
17
17
var http =require('http');
18
18
var url =require('url');
19
19
var fs =require('fs');
20
20
```
21
21
22
22
7. Create an http server:
23
23
24
-
```
24
+
```js
25
25
http.createServer(function (req, res) {
26
26
}).listen(8080);
27
27
```
@@ -30,14 +30,14 @@ This will start a web server. The server is available to test by opening a brows
30
30
31
31
8. Inside the `createServer` function add code to fetch the current URL:
32
32
33
-
```
33
+
```js
34
34
var q =url.parse(req.url, true);
35
35
var filename ="."+q.pathname;
36
36
```
37
37
38
38
9. Inside the `createServer` function, after the the previous lines of code, add code to load the appropriate HTML file based on the URL. For example the URL `http://localhost:8080/index.html` will should the index.html file.
0 commit comments