golang_rest_api

command module
v0.0.0-...-cd18d86 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 6 Imported by: 0

README

Rest API - Golang Project

This is a sample RESTful API project built using Golang, featuring book categories and user entities. The application supports CRUD operations for managing categories, users, and books. The project is dockerized and utilizes PostgreSQL as its database.

Table of Contents

Getting Started

To get started with this project, follow the steps below:

  1. Clone the repository:

    git clone https://github.com/your-username/rest_api_sample.git
    cd rest_api_sample
    
    
  2. Set up your database: PostgreSQL database and update the database configuration in the config/config.go file.

  3. Dockerize the API:

    docker build -t my-api
    
    
  4. Compose up the docker-compose.yml

    docker-compose up -d
    
    
    

API Documentation

Category Endpoints

  • GET /category: Retrieve all categories.
  • GET /category/{id}: Retrieve a specific category by ID.
  • POST /category: Create a new category.
  • PUT /category/{id}: Update a category by ID.
  • DELETE /category/{id}: Delete a category by ID.

User Endpoints

  • GET /user: Retrieve all users.
  • GET /user/{id}: Retrieve a specific user by ID.
  • POST /user: Create a new user.
  • PUT /user/{id}: Update a user by ID.
  • DELETE /user/{id}: Delete a user by ID.

Book Endpoints

  • GET /book: Retrieve all books.
  • GET /book/{id}: Retrieve a specific book by ID.
  • POST /book: Create a new book.
  • PUT /book/{id}: Update a book by ID.
  • DELETE /book/{id}: Delete a book by ID.

Swagger Implementation

The API documentation is available using Swagger. Visit /swagger/index.html after running the application to explore and interact with the API. The application will be accessible at localhost.

License

This project is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

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