Support saving file

This commit is contained in:
Lukas Martinelli
2016-12-03 16:51:47 +01:00
parent 11375008fa
commit 0d77518a02
2 changed files with 37 additions and 8 deletions
+3 -3
View File
@@ -39,9 +39,9 @@ func main() {
// Allow access to reading and writing file on the local system
path, _ := filepath.Abs(filename)
accessor := StyleFileAccessor(path)
router.Path("/files").Methods("GET").HandlerFunc(accessor.ListFiles)
router.Path("/files/{filename}").Methods("GET").HandlerFunc(accessor.ReadFile)
router.Path("/files/{filename}").Methods("PUT").HandlerFunc(accessor.SaveFile)
router.Path("/styles").Methods("GET").HandlerFunc(accessor.ListFiles)
router.Path("/styles/{styleId}").Methods("GET").HandlerFunc(accessor.ReadFile)
router.Path("/styles/{styleId}").Methods("PUT").HandlerFunc(accessor.SaveFile)
// Register websocket to notify we clients about file changes
if c.Bool("watch") {