search

Home  >  Q&A  >  body text

node.js - 初学node有点不懂

怪我咯怪我咯2876 days ago334

reply all(7)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 16:06:12

    Problems with your own app.js. Is the http service not started in it, or the listening port number is not printed, so the last sentence is not mentioned. Aren’t everything else the same as the textbook?

    Supervisor is just a node service, right? It's just that he acts as the main process and sets up a child process as your service so that it can be easily monitored.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 16:06:12

    Just start it after installation. When you originally wrote node, every time you modified the content of the server, you needed to automatically restart it to take effect. With this superviosr, it will automatically restart the service after you save it.
    But, what effect do you want? Check to see if the code is correct. It probably has nothing to do with the supervisor.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 16:06:12

    Forgive me for not knowing much

    Usually the command used to execute a js file is

    node app.js

    I seesupervisor是一个调试工具,他会创建一个进程去监听的你程序代码的变更,而不需要每次单独使用nodego execute your code.

    Actually, I think there is nothing wrong with your execution method. The so-called different prompt information you see may be caused by the system.
    Secondly, it is possible that your code and his code are different, so the monitoring results are different.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:06:12

    Put out app.js and take a look.

    reply
    0
  • 阿神

    阿神2017-04-17 16:06:12

    Although I don’t know much about node, I know that the startup should be node app.js (app is the name of your node program). Anyway, I have never used the supervisor command

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 16:06:12

    Follow your cmd prompts, haven’t you already turned on monitoring?

    reply
    0
  • 黄舟

    黄舟2017-04-17 16:06:12

    It is already running. I think you want to see a running prompt. If so, you can add a sentence at the end of app.js: app.js结尾加一句:

    console.log ('server is running on ort')

    console.log ('server is running on ort')🎜

    reply
    0
  • Cancelreply