https://github.com/willowtreeapps/go-hello-world
https://github.com/willowtreeapps/go-hello-world
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/willowtreeapps/go-hello-world
- Owner: willowtreeapps
- License: mit
- Created: 2025-04-17T15:29:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-04-17T16:41:29.000Z (8 months ago)
- Last Synced: 2025-04-18T06:18:35.080Z (8 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Task Manager API with Swagger Documentation
A simple task management API built with Go (Golang) that demonstrates how to create a RESTful service with auto-generated Swagger/OpenAPI documentation.
## Features
- RESTful API endpoints for task management
- Auto-generated Swagger documentation
## Prerequisites
- Go 1.21 or higher
- Git
## Installation
1. Clone the repository:
```bash
git clone
cd go-hello-world
```
2. Install dependencies:
```bash
go mod download
```
## Running the Application
Start the server:
```bash
go run main.go
```
The server will start at `http://localhost:8080`
## API Documentation
Swagger UI is available at: `http://localhost:8080/swagger/index.html`
### Available Endpoints
- `GET /api/v1/tasks` - List all tasks
- `GET /api/v1/tasks/{id}` - Get a specific task
- `POST /api/v1/tasks/{id}/complete` - Mark a task as complete
## Running Tests
```bash
go test -v
```
## Project Structure
- `main.go` - Main application file with API handlers and task definitions
- `main_test.go` - API endpoint tests
- `docs/` - Auto-generated Swagger documentation
- `go.mod` - Go module definition and dependencies
## Development
To regenerate Swagger documentation after making API changes:
```bash
swag init
```
## Purpose
This project serves as a demonstration of:
1. Building a RESTful API in Go
2. Implementing Swagger documentation using swag
3. Writing testable Go code
4. Using the Gin web framework
5. Proper project structure and organization