Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devenes/go-bookstore-api

This is a simple API for a bookstore that basically only has a few endpoints and built with Golang.
https://github.com/devenes/go-bookstore-api

docker go goland golang sqlite

Last synced: 10 days ago
JSON representation

This is a simple API for a bookstore that basically only has a few endpoints and built with Golang.

Awesome Lists containing this project

README

        


Go Bookstore Api

Bookstore API


Build
Tool
Tool
Tool
Github top language
Github language count
Repository size
License




🚧 Go Bookstore Api 🚀 Under construction... 🚧




About   |  
Features   |  
Technologies   |  
Requirements   |  
Starting   |  
License   |  
Author


## :dart: About ##

This is a simple API for a bookstore that basically only has a few endpoints and built with Golang.

## :sparkles: Features ##

:heavy_check_mark: List \
:heavy_check_mark: Update \
:heavy_check_mark: Delete

## :rocket: Technologies ##

The following tools were used in this project:

- [Go](https://golang.org/)
- [Gin](https://gin-gonic.com/)
- [Gorm](https://gorm.io/)
- [SQLite](https://www.sqlite.org/)
- [GitHub](https://github.com/)

## :white_check_mark: Requirements ##

Before starting :checkered_flag: you need to have [Git](https://git-scm.com), [Go](https://golang.org), [Docker](https://www.docker.com/) and [GCC](https://gcc.gnu.org/) installed on your machine.

## :checkered_flag: Starting ##

```bash
# Clone this project from GitHub
git clone https://github.com/devenes/go-bookstore-api

# Access the project folder
cd go-bookstore-api
```

- Start the locally:
```bash
go run main.go
```

- ## 🐳 Start the server in a Docker container:
```bash
docker build -t devenes/bookstore-api:1.0 ./ && docker run -p 8080:8080 -d devenes/bookstore-api:1.0 && explorer "http://localhost:8080/books"
# The server will initialize in the
```

- Add a new book:
```bash
curl -X POST -H 'content-type: application/json' --data '{"title": "Slim Jim", "author": "Jim"}' http://localhost:8080/books
```

- Get all books:
```bash
curl -X GET http://localhost:8080/books
```

- Get the book with id:
```bash
curl -X GET http://localhost:8080/books/1
```

- Update a book with id:
```bash
curl -X PATCH -H 'content-type: application/json' --data '{"title": "Slim Jim", "author": "James Miller"}' http://localhost:8080/books/1
```

- Delete the book with id 1:
```bash
curl -X DELETE http://localhost:8080/books/1
```

### Resources:
- [Go](https://golang.org/)
- [Rest API](https://blog.logrocket.com/how-to-build-a-rest-api-with-golang-using-gin-and-gorm/)

## :memo: License ##

This project is under license from Apache 2.0. For more details, see the [LICENSE](LICENSE) file.

Made with :heart: by devenes

 

⬆️ Back to top