create seprate pocketbase client
This commit is contained in:
parent
654df98711
commit
2837293474
6 changed files with 245 additions and 43 deletions
8
main.go
8
main.go
|
|
@ -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(),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue