B
B
Banan442020-05-07 10:23:50
JavaScript
Banan44, 2020-05-07 10:23:50

How to stop server/script in Node js?

const http = require("http")

http.createServer(function(request, response) {
  response.end("Hello Node.js!")
}).listen(3000, "127.0.0.1", function() {
  console.log("Сервер открыт по порту: 3000")
})

// В cmd ввожу: node main.js

Everything works, but in order to run another script, I have to restart cmd every time and re-enter the path to the folder I need, which is not very good.
How to stop the script? Are there any hotkeys or is it possible to do it only through special methods in the script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2020-05-07
@Banan44

ctrl+c

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question