DEV Community

Cover image for Getting Started - DUNE Board Game API#1
Alexander Kögel
Alexander Kögel

Posted on

Getting Started - DUNE Board Game API#1

Today we start a new series about a project I'm currently working on! But let's not waste too much time and start right away!

The project is about building an API for a DUNE board game Discord bot that returns all possible moves based on a game state as a JSON tree to make the implementation of the rules as easy as possible for the developer of the Discord bot.

To start I first downloded all needed npm packages in this case express and nodemon as dev dependencie

After the dependencie are installed we start with the basic routing via express. The basic setup of this API looks like this:

const express = require("express");
const app = express();
app.use(express.json());

app.get("/",(req, res)=>{
  res.send("Welcome to the Truthsayer Rules API created by Alexander Kögel")
})

app.get("/",(req, res) => {
  const { body } = req;

//These empty objects are used to store the data of the individual fractions and the values returned at the end.

  var data = {};
  var bene_gesserit_data = {};
  var atreides_data = {};
  var emperor_data = {};
  var harkonnen_data = {};
  var fremen_data = {};
  var spacing_guild_data = {};

  res.json(data)
})
Enter fullscreen mode Exit fullscreen mode

Since this API is only used by one person I don't worry about rate-limits and API-Keys... We will come to that later after I finished the implementation of the rules from the official DUNE Rulebook into the API!

I hope you enjoyed this short start into the series about the API! If you have any questions about the project just post them in the comments or join the Discord server of this project! There you can also test the beta of the bot!

Buy Me a Pizza

Discussion (0)