Last active
January 26, 2020 17:05
-
-
Save LautaroJayat/aa79cf91c2708927313d24f88d1a33a2 to your computer and use it in GitHub Desktop.
index.js - step 3 Sending data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const server = http.createServer((req, res) => { | |
| // Let store our URL and Method in a variable | |
| const URL = req.url; | |
| // Lets make something using conditionals | |
| if (req.url === '/') { | |
| // Note that we are using res.write() method and then using res.end(). | |
| // This is mandatory if you expect your server to work fine. | |
| res.write('Yea! Its Working! Esoteric Knowledge!', 'utf-8', () => { | |
| console.log('console.log from the callback function!') | |
| }); | |
| res.end(); | |
| } | |
| }).listen(PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment