skip to Main Content

While I have a server address just in case, how shall I know if the server running node.js?! Even more, iis or apache?
Is there any way to configure the running service on the server?

2

Answers


  1. To check the node server running by logging in to the system

    If you are using linux system then the easiest way is to check the process of the node service using pidof node which will give you the process of the node service if it is running.

    In windows you can simply go to the Task Manager and check for node in the application list. If it is there then it is running in the machine.

    To check node server from the server address

    There is no default page or URL that node server provides from which you can know that node is running on that server by using the Public IP address or domain name. If you want to setup anything such then you can create a /status GET route that will be a public route and it will return you the uptime of the server. Something like this:

    let example = {
      up_time: Math.floor(process.uptime())
    };
    
    res.statusCode = 200;
    res.setHeader('Content-Type', 'application/json');
    res.end(JSON.stringify(example));
    

    Where process.uptime() will return the time from where the server is started. Thus, you can run the URL like 192.168.10.10:3000/status (or with public IP) to check if the server is running node or not. Note that this works only when you have your own NodeJS API as you will be adding this additional /status GET route in your project.

    Login or Signup to reply.
  2. You can do this in linux:

    ps aux|grep server.js [where server.js is your filename]
    

    You can use ps-node to configure your services and running processes

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search