Answer the question
In order to leave comments, you need to log in
What hostname should be specified on the server?
Please tell me, I developed a local project with a simple code
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = https.createServer(async (req, res) => {
try {
if (req.method == 'GET') {
switch (urlParts.pathname) {
case "/":
res.writeHead(200, {"Content-Type": "text/plain"});
res.end("everythink is ok");
break;
default:
res.end("404");
break;
}
}
else {
res.end("404");
}
} catch (error) {
console.log("error", error);
}
});
server.listen(port, hostname, () => {
console.log(`Server стартанул at http://${hostname}:${port}/`);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question