Use ExpressJS app via FastCGI

前端 未结 1 741
挽巷
挽巷 2021-02-09 10:15

Just started deal with NodeJS web apps and have a fundamental question.

Since i came from the PHP realm, i know PHP have a built-in HTTP server but no one actually use i

相关标签:
1条回答
  • 2021-02-09 10:28

    You won't do mistakes like that if you lint your code, run under strict mode, and don't use global variables like that.

    Also in nodejs web applications you generally want to make the server stateless and keep all the data in the databases. This would also make it a more scalable architecture.

    In applications that are security super important, you can throw heavy fuzzy testing at it to find problems like that too.

    If you do all this, plus having a strict code review process, you won't have to worry about it at all.

    FastCGI doesn't prevent this problem as a single or a few connections is used to communicate with the server that processes the requests(node.js in this case) and HTTP connections are multiplexed through it. A node.js process will handle multiple requests at a time.

    You can potentially somehow make a solution that launches a thread but it'll be a lot slower. In case if you are using node.js for things that are required to be have high reliability or can't afford small mistakes(for example health related devices), node.js is the wrong platform for it.

    0 讨论(0)
提交回复
热议问题