- Run Terraria servers (or any other game servers) on NodeJS ⚽
- Set up your config file and start the server 💡
We can't run ".exe" files on sites like Heroku or Glitch. But we can do anything with child_process, a nice thing that NodeJS gives us. Here I give an example of "Terraria", a game I play frequently, but you can set up a server for any game you want. The working logic of the system is as follows: First, we download the server files with the "request" module and build these files with the necessary commands. (You can use child_process for this operation too.) I call this phase "build". When the "build" phase is over, we spawn the ".exe" extension server file we downloaded with child_process. And I call this phase "start". At this phase, your server is now up and running.
- Run
yarn build
ornpm run build
to build and configure server files. Make sure you use this command only once. Because every time you use this command, your old server files are deleted. 🏗️ - Run
yarn start
ornpm run start
to start server 🎬
Feel free to use GitHub's feautres. ✨