2018-12-04 19:15:41 +01:00
|
|
|
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) {
|
2018-12-08 18:01:33 +01:00
|
|
|
args := mux.Vars(r)
|
|
|
|
table := args["tableName"]
|
|
|
|
patientsList, _ := readDatabase(table)
|
2018-12-04 19:15:41 +01:00
|
|
|
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)
|
|
|
|
}
|