1
0
Alex Myasoedov 8 роки тому
батько
коміт
d70f7d37b2
2 змінених файлів з 5 додано та 2 видалено
  1. 4 1
      main.go
  2. 1 1
      templates/index.tmpl

+ 4 - 1
main.go

@@ -25,11 +25,14 @@ func NewApp() *gin.Engine {
 		if err != nil {
 			panic(err)
 		}
+    ioutil.WriteFile("slides.md", body, 0644)
 		c.String(200, string(body))
 	})
 
 	r.PUT("/slides.md", func(c *gin.Context) {
-		c.String(403, "")
+    body, _ := ioutil.ReadAll(c.Request.Body);
+    ioutil.WriteFile("slides.md", body, 0644)
+		c.String(200, "")
 	})
 
 	return r

+ 1 - 1
templates/index.tmpl

@@ -14,7 +14,7 @@
     <body>
         <div id="edit-pane">
           <div id="controls">
-            <a href="" target="_blank" onclick="save();"> Present</a>
+            <a href="{{ .pubTo}}" target="_blank" onclick="save();"> Present</a>
           </div>
           <div id="editor"></div>
         </div>