1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-10 09:52:51 +00:00
Files
mywebsite/testing_files/testApi.go

30 lines
479 B
Go

package test
import (
"encoding/json"
"fmt"
"github.com/julienschmidt/httprouter"
"net/http"
)
type ApiCall struct {
Fname string
Lname string
}
// Redirect to discord
func TestApiCall(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
s := new(ApiCall)
s.Fname = ps.ByName("fname")
s.Lname = ps.ByName("lname")
response, _ := json.MarshalIndent(s, "", " ")
w.Header().Set("Content-Type", "application/json")
fmt.Fprint(w, string(response))
}