-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (31 loc) · 911 Bytes
/
main.go
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
32
33
34
35
36
37
38
39
40
41
42
43
// Package main
package main
import (
"log"
"net/http"
"github.com/mvaldes14/api-go-otel/pkg/api"
"github.com/mvaldes14/api-go-otel/pkg/app"
"github.com/mvaldes14/api-go-otel/pkg/database"
)
func main() {
// Initialize the database
database.InitDb()
mux := http.NewServeMux()
// Register handlers.
// Application Handlers (HTMX)
mux.HandleFunc("GET /", app.IndexApp)
// Application Handlers (HTMX)
mux.HandleFunc("GET /twitch", app.TwitchApp)
// Application Handlers (HTMX)
mux.HandleFunc("GET /local", app.LocalApp)
// API Handlers
mux.HandleFunc("GET /api/health", api.IndexHandler)
// API Handlers
mux.HandleFunc("POST /api/todo", api.AddTodoHandler)
// API Handlers
mux.HandleFunc("GET /api/todo", api.GetTodoHandler)
// API Handlers
mux.HandleFunc("DELETE /api/todo/{id}", api.DeleteTodoHandler)
log.Print("Listen Running on :3000")
http.ListenAndServe(":3000", mux)
}