mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
Backend update.
This commit is contained in:
parent
f49630558d
commit
90bf6be882
9 changed files with 66 additions and 28 deletions
|
|
@ -24,24 +24,6 @@ func ApiCORS(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, *http
|
|||
}
|
||||
|
||||
func ApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
// file := "" // base directory
|
||||
|
||||
// if strings.Contains(r.URL.Path, "/config.js") {
|
||||
// file = "../public/config.js"
|
||||
// } else if r.URL.Path != "/" {
|
||||
// file = "../public" + r.URL.Path // request
|
||||
// }
|
||||
// MCRMLog("ApiGet Path: ", r.URL.Path, "; File: ", file)
|
||||
|
||||
// contentType := mime.TypeByExtension(filepath.Ext(file)) // get content type
|
||||
|
||||
// if contentType == "" {
|
||||
// file = "../public/index.html" // default
|
||||
// }
|
||||
|
||||
// MCRMLog("ApiGet File: ", file)
|
||||
|
||||
// http.ServeFile(w, r, file)
|
||||
root, err := filepath.Abs("../public")
|
||||
if err != nil {
|
||||
MCRMLog("ApiGet Abs Error: ", err)
|
||||
|
|
@ -63,8 +45,6 @@ func ApiGet(w http.ResponseWriter, r *http.Request) {
|
|||
file = filepath.Join(root, "index.html")
|
||||
}
|
||||
|
||||
// MCRMLog("ApiGet Path: ", r.URL.Path, "; File: ", file, "; Content-Type: ", contentType)
|
||||
|
||||
http.ServeFile(w, r, file)
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +66,8 @@ func ApiPost(w http.ResponseWriter, r *http.Request) {
|
|||
SaveMacro(w, r)
|
||||
case "/macro/list":
|
||||
ListMacros(w, r)
|
||||
case "/macro/open":
|
||||
OpenMacro(w, r)
|
||||
case "/macro/delete":
|
||||
DeleteMacro(w, r)
|
||||
case "/macro/play":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue