A quick question about Backend and Database

I’ve been coding a barebones multiplayer game with a turn-based battle system. After finishing both the exploration and battle systems, I got stuck with the database part since I’ve never done it before in a game engine.

I used to code games (believe it or not) in pure JavaScript and HTML, so I could just render things server-side.

What I want to do now is connect the game to the database. Since I couldn’t find any tutorial for the database I was going to use (MongoDB), I opted to lean towards using a REST API. I’m setting up a server with Express and Helmet to manage the database endpoints.

For example:

POST /api/player/UID/methods/levelUP
GET /api/player/UID/publicInfo
POST /api/battle/UID/methods/finishBattle

I’d like to know if this is the best approach for what I’m trying to do, and I’d appreciate any suggestions.

1 Like