This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
bactdb/api/species.go
Matthew Dillon 830a8805c9 Species Read - Order of ops:
router/routes.go
router/api.go
models/species_test.go
models/species.go
models/client.go
datastore/migrations/addspecies.sql
datastore/migrations/dropspecies.sql
datastore/species_test.go
datastore/species.go
datastore/datastore.go
api/species_test.go
api/species.go
api/handler.go
2014-10-15 13:01:11 -08:00

22 lines
335 B
Go

package api
import (
"net/http"
"strconv"
"github.com/gorilla/mux"
)
func serveSpecies(w http.ResponseWriter, r *http.Request) error {
id, err := strconv.ParseInt(mux.Vars(r)["Id"], 10, 0)
if err != nil {
return err
}
species, err := store.Species.Get(id)
if err != nil {
return err
}
return writeJSON(w, species)
}