
go backend demo
一个用于演示 Swagger 文档生成的 Go 语言后端 API。
Repository Info
About This Server
一个用于演示 Swagger 文档生成的 Go 语言后端 API。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
go-backend-demo
Overview
go-backend-demo is a demonstration backend API that simulates real-world API use cases. This backend is designed to generate Swagger UI documentation and will be used by the swagger-mcp project.
This backend takes reference from the following repositories:
- MehmetFiratKomurcu - golang-swaggo
- joefazee - Go API Documentation with Swagger
Features
- RESTful API with endpoints for users and orders
- Swagger UI documentation generation
- Demonstrates authentication and request handling
Installation and Setup
To run this project locally, follow these steps:
-
Install dependencies:
go mod download go mod tidy -
Generate Swagger documentation:
swag init -
Run the application:
go run main.go
API Endpoints
Base Configuration
- Host:
localhost:8080 - Base Path:
/v1
Orders API
Create Order
- Endpoint:
POST /orders - Description: Creates an order with the provided request.
- Headers:
x-correlationid(string, required) - Code of the order.
- Request Body:
{ "age": 25, "countryCode": "US", "shipmentNumber": "123456789" } - Responses:
200 OK: Order successfully created.400 Bad Request: Invalid request.
Get Order by Code
- Endpoint:
GET /orders/{orderCode} - Description: Retrieves order details by code.
- Headers:
x-correlationid(string, required) - Code of the order.
- Path Parameters:
orderCode(string, required) - The order code.
- Responses:
200 OK: Order details returned.
Users API
Get All Users
- Endpoint:
GET /users - Description: Retrieves a list of all users.
- Responses:
200 OK: List of users returned.
Create User
- Endpoint:
POST /users - Description: Creates a new user.
- Security: Requires a Bearer token.
- Request Body:
{ "username": "johndoe", "email": "john@example.com", "full_name": "John Doe", "is_active": true } - Responses:
201 Created: User successfully created.400 Bad Request: Invalid request.
Security
- Uses API key-based authentication with a Bearer token.
- Security Definition:
{ "type": "apiKey", "name": "Authorization", "in": "header" }
Swagger Documentation
Swagger UI will be available at:
http://localhost:8080/swagger/index.html
Quick Start
Clone the repository
git clone https://github.com/danishjsheikh/go-backend-demoInstall dependencies
cd go-backend-demo
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.