admissionServer/handlers.go

26 lines
557 B
Go
Raw Normal View History

package main
import (
"encoding/json"
"fmt"
"html"
"net/http"
"github.com/gorilla/mux"
)
func index(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
}
func getAll(w http.ResponseWriter, r *http.Request) {
args := mux.Vars(r)
table := args["tableName"]
patientsList, _ := readDatabase(table)
json.NewEncoder(w).Encode(patientsList)
}
func getIndex(w http.ResponseWriter, r *http.Request) {
args := mux.Vars(r)
pk := args["primaryKey"]
fmt.Fprintf(w, "Tutaj bedzie wynik dla PK = %s", pk)
}