Installation
Install and set up the goserve framework in your Go project.
Installation Methods
Using go get
bash
go get github.com/afteracademy/goserveUsing go.mod
Add to your go.mod file:
go
module your-project
go 1.21
require (
github.com/afteracademy/goserve v2.1.1
)Then run:
bash
go mod tidyVersion Selection
Check available versions:
bash
go list -m -versions github.com/afteracademy/goserveInstall a specific version:
bash
go get github.com/afteracademy/goserve@v2.1.1Dependencies
goserve includes the following dependencies (automatically managed):
- Gin - HTTP web framework
- pgx - PostgreSQL driver (for PostgreSQL support)
- github.com/redis/go-redis - Redis client (for Redis support)
- github.com/go-playground/validator - Validation library
- github.com/spf13/viper - Configuration management
- golang.org/x/crypto - Cryptographic utilities
Verify Installation
Check if goserve is installed:
bash
go list -m github.com/afteracademy/goserveYou should see output like:
github.com/afteracademy/goserve v2.1.1Import in Your Code
go
import (
"github.com/afteracademy/goserve/network"
"github.com/afteracademy/goserve/postgres" // For PostgreSQL
"github.com/afteracademy/goserve/redis" // For Redis
"github.com/afteracademy/goserve/middleware" // For middleware
)Project Setup
1. Initialize Go Module
bash
mkdir my-project
cd my-project
go mod init my-project2. Install goserve
bash
go get github.com/afteracademy/goserve3. Create Basic Structure
my-project/
├── cmd/
│ └── main.go
├── api/
│ └── (your features)
├── config/
│ └── config.go
└── go.modDatabase Drivers (Optional)
PostgreSQL
If you need PostgreSQL support:
bash
go get github.com/afteracademy/goserve/postgresRedis
If you need Redis support:
bash
go get github.com/afteracademy/goserve/redisTroubleshooting
Module Not Found
If you get "module not found" errors:
bash
# Clean module cache
go clean -modcache
# Download dependencies
go mod download
# Verify modules
go mod verifyVersion Conflicts
If you encounter version conflicts:
bash
# Update all dependencies
go get -u ./...
# Or update specific package
go get -u github.com/afteracademy/goserve@latestGo Version
Ensure you're using Go 1.21 or higher:
bash
go versionIf you need to update Go, visit golang.org/dl
Next Steps
- ✅ Installation complete? Start with Getting Started
- 🏗️ Learn about Framework Architecture
- 🔧 Configure your setup: Configuration Guide
