File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -181,14 +181,14 @@ Common use for the File System module:
181
181
* Delete files
182
182
* Rename files
183
183
184
- ** Read Files**
185
- index.html
184
+ ** Example:** Read Files
186
185
187
186
``` html
187
+ <!-- index.html -->
188
188
<html >
189
189
<body >
190
- <h1 >My Header</h1 >
191
- <p >My paragraph .</p >
190
+ <h1 >File Header</h1 >
191
+ <p >File Paragraph .</p >
192
192
</body >
193
193
</html >
194
194
```
@@ -199,19 +199,14 @@ index.html
199
199
*/
200
200
const http = require (' http' );
201
201
const fs = require (' fs' );
202
+
202
203
http .createServer (function (req , res ) {
203
204
fs .readFile (' index.html' , function (err , data ) {
204
205
res .writeHead (200 , {' Content-Type' : ' text/html' });
205
206
res .write (data);
206
207
res .end ();
207
208
});
208
- }).listen (8080 );
209
- ```
210
-
211
- Initiate read_file.js:
212
-
213
- ``` js
214
- node read_file .js
209
+ }).listen (3000 );
215
210
```
216
211
217
212
<div align =" right " >
You can’t perform that action at this time.
0 commit comments