From 9dcbd54387c5ba67abad0d01a478932cfb27e79c Mon Sep 17 00:00:00 2001 From: William P Date: Tue, 12 May 2026 02:30:13 +0000 Subject: [PATCH] server: implement chi --- server/api/api.go | 17 +++++++++++++++++ server/go.mod | 2 ++ server/go.sum | 2 ++ server/main.go | 11 ++++++++++- 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 server/api/api.go create mode 100644 server/go.sum diff --git a/server/api/api.go b/server/api/api.go new file mode 100644 index 0000000..d55fb1e --- /dev/null +++ b/server/api/api.go @@ -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) +} diff --git a/server/go.mod b/server/go.mod index 07f5e7a..4d6731f 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,3 +1,5 @@ module git.dubyatp.xyz/dubyatp/scannerbot/server go 1.26.3 + +require github.com/go-chi/chi/v5 v5.2.5 // indirect diff --git a/server/go.sum b/server/go.sum new file mode 100644 index 0000000..a4ac04e --- /dev/null +++ b/server/go.sum @@ -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= diff --git a/server/main.go b/server/main.go index 002a5c7..557e6f4 100644 --- a/server/main.go +++ b/server/main.go @@ -1,5 +1,14 @@ package main +import ( + "log/slog" + + "git.dubyatp.xyz/dubyatp/scannerbot/server/api" +) + func main() { - println("hello world") + //println("hello world") + + slog.Info("Starting the API server...") + api.Start() }