Skip to content

PNKDuy/threadin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API-SANDBOX

A concise project description detailing what this API does. This Go application provides a robust API framework with efficient routing using the Gin framework and includes Swagger documentation for easy endpoint references.

Table of Contents

Prerequisites

  • Go (at least v1.15)
  • Gin framework
  • Swagger for Go

Install Go: Go's official installation guide

Install Gin:

go get -u github.com/gin-gonic/gin

Install Swagger for Go:

go get -u github.com/swaggo/swag/cmd/swag

Installation

  1. Clone this repository:
git clone <repository-url>
  1. Navigate to the project directory and install all dependencies:
go mod tidy

File Structure

  • main.go: The entrypoint of the application, initializes and starts the server.
  • router.go: Takes care of routing and HTTP request handling. It leverages the Gin framework to ensure efficient routing and middlewares.
  • handler.go: This file houses the handler function responsible for managing the GET API endpoint, ensuring that requests are processed and the appropriate response is returned.
  • swagger.go: Automatically generates Swagger documentation for the API. This aids in understanding the API structure, endpoints, and what each endpoint is expected to do.

Usage

1.Start the server:

go run main.go

Navigate to your API (default is http://localhost:8080) using a browser or a tool like Postman to test your endpoints.

Documentation

For API documentation, navigate to /swagger (e.g., http://localhost:8080/swagger-ui/index.html) to view the Swagger UI with a list of all API endpoints, their purposes, and expected responses.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published