mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 15:10:19 +00:00
34 lines
723 B
Go
34 lines
723 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
func Index(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintln(w,bot.exchanges[0].GetName())
|
|
|
|
|
|
}
|
|
|
|
func TodoIndex(w http.ResponseWriter, r *http.Request) {
|
|
|
|
todos := Todos{
|
|
Todo{Name: "Write presentation"},
|
|
Todo{Name: "Host meetup"},
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
|
w.WriteHeader(http.StatusOK)
|
|
if err := json.NewEncoder(w).Encode(todos); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func TodoShow(w http.ResponseWriter, r *http.Request) {
|
|
vars := mux.Vars(r)
|
|
todoId := vars["todoId"]
|
|
fmt.Fprintln(w, "Todo show:", todoId)
|
|
} |