mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 14:17:21 +01:00
Rig up CardDAV backend to HTTP server
References: https://todo.sr.ht/~sircmpwn/tokidoki/3
This commit is contained in:
parent
13008e0d96
commit
97f86226d6
4 changed files with 50 additions and 3 deletions
|
|
@ -6,10 +6,12 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/emersion/go-webdav/carddav"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
|
||||
"git.sr.ht/~sircmpwn/tokidoki/auth"
|
||||
"git.sr.ht/~sircmpwn/tokidoki/storage"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -31,9 +33,8 @@ func main() {
|
|||
authProvider := auth.NewIMAP("imap.migadu.com:993", true)
|
||||
mux.Use(authProvider.Middleware())
|
||||
|
||||
mux.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Hello world!\n"))
|
||||
})
|
||||
backend := storage.NewPostgreSQL()
|
||||
mux.Handle("/", &carddav.Handler{Backend: backend})
|
||||
|
||||
server := http.Server{
|
||||
Addr: addr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue