28 lines
706 B
Go
28 lines
706 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"html"
|
|
"net/http"
|
|
"time"
|
|
|
|
"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) {
|
|
patientsList := patients{
|
|
patient{"kss", "dasda", "asdasd a", time.Now(), patientStates(critical), sex(m), "xxx@yyy.zz"},
|
|
patient{"00112245789", "Adam", "Marcel", time.Now(), patientStates(stable), sex(k), "xxxx@yyy.zz"},
|
|
}
|
|
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)
|
|
}
|