Skip to content

gareisdev/go-books-restapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GO Books REST API

Go Report

This is a little REST API built with GO and uses MariaDB to store data.

Packages:

  • GORM
  • Mux

Endpoints

Get all books

  GET /api/books

Schema response

[
  {
    "ID": null,
    "title": "",
    "author": "",
    "publication": "",
    "UpdatedAt": "2022-12-04T00:00:00.000Z",
    "CreatedAt": "2022-12-04T00:00:00.000Z"
  }
]

Get book

  GET /api/books/${id}
Parameter Type Description
id number Required. Id of book to fetch

Schema response

{
    "ID": null,
    "title": "",
    "author": "",
    "publication": "",
    "UpdatedAt": "2022-12-04T00:00:00.000Z",
    "CreatedAt": "2022-12-04T00:00:00.000Z"
}

Create book

  POST /api/books

Body

{
    "title": "",
    "author": "",
    "publication": "",
}

Schema response

{
    "ID": null,
    "title": "",
    "author": "",
    "publication": "",
    "UpdatedAt": "2022-12-04T00:00:00.000Z",
    "CreatedAt": "2022-12-04T00:00:00.000Z"
}

Update book

  PUT /api/books/${id}
Parameter Type Description
id number Required. Id of book to fetch

Body

{
    "title": "",
    "author": "",
    "publication": "",
}

Schema response

{
    "ID": null,
    "title": "",
    "author": "",
    "publication": "",
    "UpdatedAt": "2022-12-04T00:00:00.000Z",
    "CreatedAt": "2022-12-04T00:00:00.000Z"
}

Delete book

  DELETE /api/books/${id}
Parameter Type Description
id number Required. Id of book to fetch

Schema response

{
    "ID": null,
    "title": "",
    "author": "",
    "publication": "",
    "UpdatedAt": "2022-12-04T00:00:00.000Z",
    "CreatedAt": "2022-12-04T00:00:00.000Z"
}

Run Locally

Clone the project

  git clone https://github.com/gareisdev/go-books-restapi

Go to the project directory

  cd go-books-restapi

Up containers

  docker-compose up

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published