Sunday 23 December 2018

a problem with sending a response

Hi everyone,   I'm using Linux Ubuntu. I've downloaded node.js through this link by completing those steps and it's installed successfully. I get request data in my terminal when run the file. But when i try to send a response on localhost:3000 it just keeps loading and doesn't send the response. What could be the problem? Could you please help?Thanks in advance for your time​i'm using this code:​const http = require('http');const server = http.createServer((req, res) => {console.log(req.url, req.method, req.headers);res.setHeader('Content-Type', 'text/html');res.write('');res.write('');res.write('

Hello from my Node.js Server!

');res.write('');res.end();});server.listen(3000);​

Submitted December 23, 2018 at 10:04AM by heyoomark

No comments:

Post a Comment