go fmt
This commit is contained in:
parent
5a641ceca1
commit
13008e0d96
@ -25,7 +25,7 @@ func NewIMAP(addr string, tls bool) AuthProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (prov *IMAPProvider) Middleware() func(http.Handler) http.Handler {
|
func (prov *IMAPProvider) Middleware() func(http.Handler) http.Handler {
|
||||||
return func (next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
prov.doAuth(next, w, r)
|
prov.doAuth(next, w, r)
|
||||||
})
|
})
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
|
|
||||||
@ -31,11 +31,11 @@ func main() {
|
|||||||
authProvider := auth.NewIMAP("imap.migadu.com:993", true)
|
authProvider := auth.NewIMAP("imap.migadu.com:993", true)
|
||||||
mux.Use(authProvider.Middleware())
|
mux.Use(authProvider.Middleware())
|
||||||
|
|
||||||
mux.Get("/", func (w http.ResponseWriter, r *http.Request) {
|
mux.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte("Hello world!\n"))
|
w.Write([]byte("Hello world!\n"))
|
||||||
})
|
})
|
||||||
|
|
||||||
server := http.Server {
|
server := http.Server{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user