mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 07:26:46 +00:00
Adds Notification angular module Adds Requestify for ExpressJS to make posting ezpz Now can post data to gocryptoCore GoCrypto can now receive data on settings save
41 lines
724 B
Go
41 lines
724 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func getAllSettings(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
|
w.WriteHeader(http.StatusOK)
|
|
if err := json.NewEncoder(w).Encode(bot.config); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func saveAllSettings(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
if err := json.NewEncoder(w).Encode(true); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
var configRoutes = Routes{
|
|
Route{
|
|
"GetAllSettings",
|
|
"GET",
|
|
"/config/all",
|
|
getAllSettings,
|
|
},
|
|
|
|
Route{
|
|
"SaveAllSettings",
|
|
"POST",
|
|
"/config/all/save",
|
|
saveAllSettings,
|
|
},
|
|
}
|