Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
/ heroes Public archive

Simple REST API and simple frontend done in Go and Flutter

Notifications You must be signed in to change notification settings

bvlourenco/heroes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Hero REST API

Hero

The Hero object has the following structure:

{
    id: primitive.ObjectID,
    name: String
}

Endpoints

The API handles the following HTTP requests:

METHOD PATH PAYLOAD RESPONSE DESCRIPTION
GET /hero [Hero] Gets all heroes
POST /hero { name: String } Hero Add a new hero
DELETE /hero/{id} Hero Removes a hero
GET /hero/{id} Hero Gets a specific hero
PUT /hero { id: primitive.ObjectID, name: String } Hero Changes the hero's name

Status codes

  • Get /hero
Status code Occasion
200 Every situation
  • POST /hero
Status code Occasion
400 Wrong fields, wrong types or empty name
500 Internal Server Error (e.g. Database error)
200 Otherwise
  • DELETE /hero/{id}
Status code Occasion
400 Invalid id (empty or not an integer)
404 Hero not found
500 Internal Server Error (e.g. Database error)
200 Otherwise
  • GET /hero/{id}
Status code Occasion
400 Invalid id (empty or not an integer)
404 Hero not found
500 Internal Server Error (e.g. Database error)
200 Otherwise
  • PUT /hero
Status code Occasion
400 Wrong fields, wrong types or empty name
404 Hero not found
500 Internal Server Error (e.g. Database error)
200 Otherwise

About

Simple REST API and simple frontend done in Go and Flutter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published