Template
first commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"api-service/internal/config"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(cfg *config.Config) *gin.Engine {
|
||||
// Atur mode Gin berdasarkan konfigurasi
|
||||
gin.SetMode(cfg.Server.Mode)
|
||||
router := gin.New()
|
||||
|
||||
// =============================================================================
|
||||
// GLOBAL MIDDLEWARE STACK (Middleware yang diperlukan SEMUA route)
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// INISIALISASI SERVIS & HANDLER
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// SWAGGER DOCUMENTATION (Publik - TANPA SecurityHeaders)
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// API GROUPS (Dengan Keamanan Ketat)
|
||||
// =============================================================================
|
||||
// Terapkan middleware keamanan dan validasi input HANYA ke grup API.
|
||||
// Ini adalah perubahan utama.
|
||||
|
||||
|
||||
// --- HEALTH CHECK & SYSTEM ROUTES ---
|
||||
|
||||
|
||||
// --- API v1 GROUP ---
|
||||
// =============================================================================
|
||||
// PUBLIC ROUTES (No Authentication Required)
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// PROTECTED ROUTES (Authentication Required)
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// DEBUG ROUTES (Publik - Tanpa keamanan ketat)
|
||||
// =============================================================================
|
||||
|
||||
return router
|
||||
}
|
||||
Reference in New Issue
Block a user