demo-bookstore-api

command module
v0.0.0-...-6e34661 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 11 Imported by: 0

README

demo-bookstore-api

Welcome to the Bookstore API project! This repository contains a RESTful API built using Go that allows you to manage a collection of books. Whether you're a book enthusiast or a developer looking to learn Go, this project provides a practical example of how to design and implement a web API.

Table of Contents

Features

  • Create, Read, Update, and Delete (CRUD) operations for managing books.
  • Error handling and validation for robust data processing.
  • SQLite database integration for persistent storage.
  • RESTful API design with clear and intuitive endpoints.

Getting Started

Prerequisites
Running the API

Install the dependencies

go get .

Run the server

go run main.go

API Documentation

Swagger API Documentation are automatically generated by swag.

Swagger API Documentation can be accessed at http://localhost:8080/swagger/index.html

Usage Examples

  1. Retrieve all books:
curl http://localhost:8080/api/v1/books
  1. Create a new book:
curl -X POST http://localhost:8080/api/v1/books -d '{"title": "Sample Book", "author": "John Doe", "genre": "Fiction"}'
  1. Update a book
curl -X PUT http://localhost:8080/api/v1/books/{bookID} -d '{"title": "Updated Book Title"}'
  1. Delete a book
curl -X DELETE http://localhost:8080/api/v1/books/{bookID}

Contributing

Contributions are welcome! If you find a bug or have an enhancement in mind, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL