You've already forked gun-manager-backend
21 lines
342 B
Go
21 lines
342 B
Go
package Photo
|
|
|
|
import (
|
|
"git.siteworxpro.com/gun-manager/sql"
|
|
"github.com/gorilla/mux"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
func Get(w http.ResponseWriter, r *http.Request) {
|
|
db := sql.GetDb()
|
|
id, _ := strconv.ParseInt(mux.Vars(r)["id"], 10, 32)
|
|
|
|
photo := db.GetPhoto(uint(id))
|
|
|
|
_, err := w.Write([]byte(photo))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|