-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
31 lines (25 loc) · 908 Bytes
/
main.go
File metadata and controls
31 lines (25 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"fmt"
"log"
"net/http"
"handler/pkg/router"
)
func main() {
port := "8080"
http.HandleFunc("/", router.Route)
fmt.Printf("🚀 Server running on http://localhost:%s\n\n", port)
fmt.Println("📍 Available endpoints:")
fmt.Println(" GET http://localhost:" + port + "/")
fmt.Println(" GET http://localhost:" + port + "/health")
fmt.Println("\n📍 API V1:")
fmt.Println(" GET http://localhost:" + port + "/api/v1/users")
fmt.Println(" POST http://localhost:" + port + "/api/v1/users")
fmt.Println(" GET http://localhost:" + port + "/api/v1/users/:id")
fmt.Println(" GET http://localhost:" + port + "/api/v1/products")
fmt.Println(" POST http://localhost:" + port + "/api/v1/products")
fmt.Println("\n📍 API V2:")
fmt.Println(" GET http://localhost:" + port + "/api/v2/users")
fmt.Println()
log.Fatal(http.ListenAndServe(":"+port, nil))
}