25 lines
527 B
Go
25 lines
527 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
// "POST /v1/movies" endpoint.
|
|
func (app *application) createMovieHandler(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintln(w, "create a new movie")
|
|
}
|
|
|
|
// "GET /v1/movies/:id"
|
|
func (app *application) showMovieHandler(w http.ResponseWriter, r *http.Request) {
|
|
id, err := app.readIDParam(r)
|
|
|
|
if err != nil || id < 1 {
|
|
http.NotFound(w, r)
|
|
return
|
|
}
|
|
|
|
// Otherwise, interpolate the movie ID in a placeholder response.
|
|
fmt.Fprintf(w, "show the details of movie %d\n", id)
|
|
}
|