18 lines
287 B
Go
18 lines
287 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
"dogapi/db"
|
|
"encoding/json"
|
|
"dogapi/structs"
|
|
)
|
|
|
|
func APIHandler(w http.ResponseWriter, r *http.Request) {
|
|
switch r.Method {
|
|
case "GET":
|
|
var dogquery structs.DogPicRow
|
|
dogquery = db.RandomSelect()
|
|
json.NewEncoder(w).Encode(dogquery)
|
|
}
|
|
}
|