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 @@ -1141,14 +1141,14 @@ Common use for the File System module:
1141
1141
* Delete files
1142
1142
* Rename files
1143
1143
1144
- ** Read Files**
1145
- index.html
1144
+ ** Example:** Read Files
1146
1145
1147
1146
``` html
1147
+ <!-- index.html -->
1148
1148
<html >
1149
1149
<body >
1150
- <h1 >My Header</h1 >
1151
- <p >My paragraph .</p >
1150
+ <h1 >File Header</h1 >
1151
+ <p >File Paragraph .</p >
1152
1152
</body >
1153
1153
</html >
1154
1154
```
@@ -1159,19 +1159,14 @@ index.html
1159
1159
*/
1160
1160
const http = require (' http' );
1161
1161
const fs = require (' fs' );
1162
+
1162
1163
http .createServer (function (req , res ) {
1163
1164
fs .readFile (' index.html' , function (err , data ) {
1164
1165
res .writeHead (200 , {' Content-Type' : ' text/html' });
1165
1166
res .write (data);
1166
1167
res .end ();
1167
1168
});
1168
- }).listen (8080 );
1169
- ```
1170
-
1171
- Initiate read_file.js:
1172
-
1173
- ``` js
1174
- node read_file .js
1169
+ }).listen (3000 );
1175
1170
```
1176
1171
1177
1172
<div align =" right " >
You can’t perform that action at this time.
0 commit comments