up
This commit is contained in:
parent
36cbc0f5df
commit
9407799fa6
@ -9,10 +9,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
"golang.org/x/net/webdav"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,6 +65,12 @@ func RoutesPublic(r *mux.Router, bd *gorm.DB) {
|
|||||||
http.Error(w, "Erreur lors de la génération de la playlist", http.StatusInternalServerError)
|
http.Error(w, "Erreur lors de la génération de la playlist", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
webdavHandler := &webdav.Handler{
|
||||||
|
Prefix: "/webdav/",
|
||||||
|
FileSystem: webdav.Dir("/app/upload"),
|
||||||
|
LockSystem: webdav.NewMemLS(),
|
||||||
|
}
|
||||||
|
r.PathPrefix("/webdav/").Handler(http.StripPrefix("/webdav/", webdavHandler))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
main.go
9
main.go
@ -9,7 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"golang.org/x/net/webdav"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -38,12 +37,8 @@ func main() {
|
|||||||
fs := http.StripPrefix("/upload/", http.FileServer(http.Dir("/app/upload")))
|
fs := http.StripPrefix("/upload/", http.FileServer(http.Dir("/app/upload")))
|
||||||
r.PathPrefix("/upload/").Handler(fs)
|
r.PathPrefix("/upload/").Handler(fs)
|
||||||
|
|
||||||
webdavHandler := &webdav.Handler{
|
|
||||||
Prefix: "/webdav/",
|
|
||||||
FileSystem: webdav.Dir("/app/upload"),
|
|
||||||
LockSystem: webdav.NewMemLS(),
|
|
||||||
}
|
|
||||||
r.PathPrefix("/webdav/").Handler(http.StripPrefix("/webdav/", webdavHandler))
|
|
||||||
|
|
||||||
// 7. Lancer le serveur sur le port 4000
|
// 7. Lancer le serveur sur le port 4000
|
||||||
log.Fatal(http.ListenAndServe(":4000", r))
|
log.Fatal(http.ListenAndServe(":4000", r))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user