create seprate pocketbase client

This commit is contained in:
Travis Shears 2025-09-27 14:39:18 +02:00
parent 654df98711
commit 2837293474
6 changed files with 245 additions and 43 deletions

View file

@ -15,17 +15,17 @@ import (
gemini "github.com/kulak/gemini"
)
type ExampleHandler struct {
type MainHandler struct {
blog microblog.Handler
}
func (h ExampleHandler) ServeGemini(w gemini.ResponseWriter, req *gemini.Request) {
func (h MainHandler) ServeGemini(w gemini.ResponseWriter, req *gemini.Request) {
slog.Info("gemini request",
"path", req.URL.Path,
"user", strings.Join(userName(req), " "))
// Check if this is a blog request
if strings.HasPrefix(req.URL.Path, "/blog") {
if strings.HasPrefix(req.URL.Path, "/microblog") {
h.blog.HandleBlogRequest(w, req)
return
}
@ -102,7 +102,7 @@ func main() {
flag.StringVar(&key, "key", "server.key.pem", "private key associated with certificate file")
flag.Parse()
handler := ExampleHandler{
handler := MainHandler{
blog: microblog.NewHandler(),
}