Skip to content

Commit d459495

Browse files
committed
Copilot third commit
1 parent be60803 commit d459495

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

comments.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
// Create Web Server
22
// Create a web server that listens on port 3000 and serves the comments.html file
33
// when someone visits http://localhost:3000/comments.
4-
// Use the fs module to read the comments.html file and serve it back to the user.
5-
// Use the http module to create the server.
64

7-
const http = require('http');
8-
const fs = require('fs');
9-
const path = require('path');
5+
// This means you will need to create a comments.html file in your project directory.
6+
// The comments.html file should have an h1 tag that says "Comments" and a ul tag
7+
// with at least 5 li tags with comments in them.
108

11-
const server = http.createServer((req, res) => {
12-
console.log(`Request made to ${req.url}`);
9+
// When you visit http://localhost:3000/comments in your browser, you should see the
10+
// comments page.
1311

14-
if (req.url === '/comments') {
15-
fs.readFile(path.join(__dirname));}
16-
});
12+
// Make sure you are using the fs module to read the contents of the comments.html
13+
// file.
14+
15+
// You can use the following code to read the contents of the comments.html file:
16+
17+
// fs.readFile('./comments.html', 'utf8', (err, data) => {
18+
// if (err) {
19+
// throw err;
20+
// }
21+
// console.log(data);
22+
// });
23+
// You can use the following code to serve the contents of the comments.html file:
24+
25+
// http.createServer((req, res) => {
26+
// fs.readFile('./comments.html', 'utf8'

0 commit comments

Comments
 (0)