18
handlers/apihandler.go
Normal file
18
handlers/apihandler.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"log"
|
||||
"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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user