Answers for "node stop execution"

12

node js stop

process.exit();
Posted by: Guest on June-11-2020
0

node how to stop NodeJS server process

const http = require("http");

const server = http.createServer(function (req, res) {
  const url = req.url;

  if (url === "/") {
    // do a 200 response
    res.writeHead(200, { "Content-Type": "text/html" });
    res.write("<h1>Hello World!<h1>");
    res.end();
  }
});

server.listen(3000, function () {
  console.log("server started at port 3000");
});
Posted by: Guest on March-01-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language