Can the code in the server of Node.js be accessed by the client?

后端 未结 2 936
情书的邮戳
情书的邮戳 2021-01-26 14:54

I want to develop a game in NodeJS but i\'m not sure how much \'easily\' hackable it is. For example if i write my game rules in PHP modifing them will need the hacker to actual

相关标签:
2条回答
  • 2021-01-26 15:28

    The actual code of your Node.js app will remain unexposed. Ideally, your client (whatever you're doing on the browser side of things, whether this is rendering html elements or using html5 canvas) will only handle I/O and update your server, while your server will take care of all logic.

    You can still use javascript client side, but keep in mind that your fear is legitimate concerning client side javascript. This is why it is common practice to separate input/output code (which happens in javascript on the client) from game logic code that happens on the server. So the worst thing someone would be able to do is to send a message to your server saying they are pressing every key at once, and you can filter for things like this.

    0 讨论(0)
  • 2021-01-26 15:31

    Developing in nodejs means javascript on server. Javascript code on server which your players will not be able to see unless you open-source your game. This code won't be exposed to your players.

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