-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
33 lines (27 loc) · 978 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
package gox
import (
"net/http"
m "github.com/narsus81/gox/internal/model"
)
type Gox struct {
version string
config m.Config
mux *http.ServeMux
patterns map[string]m.Route
Chain []m.Middleware
}
func Init() *Gox {
c := m.Config{
Debug: true,
Daytona: true,
HTMX: `<script src="https://unpkg.com/[email protected]" integrity="sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ" crossorigin="anonymous"></script>`,
SSE: `<script src="https://unpkg.com/[email protected]/sse.js" crossorigin="anonymous"></script>`,
Autogen: `hx-ext="sse" sse-connect="/sse" sse-swap="First"`,
Autogen2: `hx-ext="sse" sse-connect="/sse2" sse-swap="Second"`,
DefaultTmpl: "templates/default.tmpl",
}
g := Gox{version: "v0.1.6", config: c, mux: http.NewServeMux(), patterns: make(map[string]m.Route)}
g.loadChain()
g.HandleFunc("root", "/{$}", func(w http.ResponseWriter, r *http.Request) {})
return &g
}