Skip to content

tufcoder/dnd-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DnD API

I will provide an API to generate characters attributes for Dungeons and Dragons RPG.
By default, the application is running on port 1337. You can change the port in the file .env.
For exemple, to generate scores using the rule 4d6 use the endpoint http://localhost:1337/attributes/4d6.

How execute the code

❗ Important

The Frontend only works IF the backend is initialized!

  1. Clone this repository git clone [email protected]:tufcoder/dnd-api.git.
  2. In your terminal, access the folder ~/dnd-api/backend.
  3. Type npm i to install/update the dependencies;
  4. Start the server, type npm run dev and await the message Server is running.
  5. Open another terminal, access the folder ~/dnd-api/frontend and execute the step 3.
  6. Start the app with npm run dev and await from the Vite local address, something like http://localhost:5173/.
  7. Click in one button to generate the ability scores using the backend API.

Backend Routes

routes

POST

  • Generates new attributes and returns the scores
  • Parameters:
    • maximum_attributes
      • Must be a value between 1 and 6
    • minimal_score
      • Must be a value between 3 and 18
  • Endpoints:
    • /attributes/4d6
    • /attributes/1d10plus8
    • /attributes/1d8plus10
    • /attributes/3d6

GET

  • Recover the scores generated by the POST routes
  • Endpoint:
    • /attributes

API DOC

SWAGGER

Launch the application and access the URL:

http://localhost:1337/api/

swagger

Stacks

  • NodeJS
  • Express
  • TypeScript
  • React

Frontend App

That's a simple app to test the API endpoints.

app

About

DnD Attributes Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published