Skip to content

Commit

Permalink
Update fileserver.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-Robson authored May 11, 2024
1 parent f599e3b commit 55c0510
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions learnyounode/fileserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ const server1 = http.createServer((req, res) => {
fs.createReadStream(filePath).pipe(res);
});

const server2 = http.createServer((req, res) => {
const readStream = fs.createReadStream(filePath);

readStream.pipe(res);
});

server.listen(port, () => {
console.log(`HTTP server is listening on port ${port}`);
});
server1.listen(port, () => console.log(`HTTP server is listening on port ${port}`));

// Official Solution:

Expand Down

0 comments on commit 55c0510

Please sign in to comment.