ni8mr ni8mr - 1 year ago 55
Node.js Question

Deleting a NodeJs app from server

I have configured a server for NodeJS and ran a Hello World app at the localhost:8080.

I am configuring a server for first time, so i have just tested my server with this app. Now i want to run another app at the localhost:8080. So i have tried to delete previous app, which is running from a hello.js file -

sudo rm -rf hello.js

File is deleted now but the app is still running at localhost:8080. I have tested with
curl http://localhost:8080/
and found the result of the deleted app -

Hello World!

How can i delete this app perfectly ?

Answer Source
  1. Use killall node or pkill node.
  2. Or alternatively, you can do:
    • ps aux | grep node
    • kill -9 <pid> (You get pids from the ps command.)

Beware that these will stop all Node.js servers. Exercise caution.