Answers for "how to kill server in node js"

3

how to stop a node server from running

ps aux | grep node

kill -9 PROCESS_ID
Posted by: Guest on November-26-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 "Shell/Bash"

Browse Popular Code Answers by Language