Skip to content

Instantly share code, notes, and snippets.

@mickael-kerjean
Last active May 10, 2022 19:16
Show Gist options
  • Save mickael-kerjean/f2f034bdad5e077edcbfdff649d52d68 to your computer and use it in GitHub Desktop.
Save mickael-kerjean/f2f034bdad5e077edcbfdff649d52d68 to your computer and use it in GitHub Desktop.
minimal webdav server
// go mod init example.com && go get .
// CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o webdav.bin main.go
package main
import (
"fmt"
"github.com/google/go-webdav"
"github.com/google/go-webdav/memfs"
"net/http"
)
func main() {
srv := webdav.NewWebDAV(memfs.NewMemFS())
fmt.Printf("Running server on http://localhost:8080/\n")
err := http.ListenAndServe(":8080", srv)
if err != nil {
fmt.Printf("Issue while running the server %s", err.Error())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment