server: implement chi
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Start() {
|
||||||
|
r := chi.NewRouter()
|
||||||
|
|
||||||
|
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Write([]byte("hello world"))
|
||||||
|
})
|
||||||
|
|
||||||
|
http.ListenAndServe(":3000", r)
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
module git.dubyatp.xyz/dubyatp/scannerbot/server
|
module git.dubyatp.xyz/dubyatp/scannerbot/server
|
||||||
|
|
||||||
go 1.26.3
|
go 1.26.3
|
||||||
|
|
||||||
|
require github.com/go-chi/chi/v5 v5.2.5 // indirect
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
github.com/go-chi/chi/v5 v5.2.5 h1:Eg4myHZBjyvJmAFjFvWgrqDTXFyOzjj7YIm3L3mu6Ug=
|
||||||
|
github.com/go-chi/chi/v5 v5.2.5/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=
|
||||||
+10
-1
@@ -1,5 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"git.dubyatp.xyz/dubyatp/scannerbot/server/api"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
println("hello world")
|
//println("hello world")
|
||||||
|
|
||||||
|
slog.Info("Starting the API server...")
|
||||||
|
api.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user