Files
greenlight/README.md
2025-10-10 14:36:02 +02:00

38 lines
1.5 KiB
Markdown

# Endpoints
| Method | URL Pattern | Handler | Action |
|--------|-----------------|---------------------|--------------------------------------|
| GET | /v1/healthcheck | healthCheckHandler | Show application information |
| GET | /v1/movies | listMoviesHandler | Show the details of all movies |
| POST | /v1/movies | createMoviesHandler | Create a new movie |
| GET | /v1/movies/:id | showMovieHandler | Show the details of a specific movie |
| PUT | /v1/movies/:id | editMovieHandler | Edit the details of a specific movie |
| DELETE | /v1/movies/:id | deleteMovieHandler | Delete a specific movie |
# Installation
## Launch API
`go run ./cmd/api`
If you want, you can also verify that the command-line flags are working correctly by specifying alternative **port** and **env** values when starting the application.
When you do this, you should see the contents of the log message change accordingly. For example :
`go run ./cmd/api -port=3030 -env=production`
**time=2025-10-10T11:08:00.000+02:00 level=INFO msg=
"starting server" addr=:3030 env=production**
## Test endpoints
`curl -i localhost:4000/v1/healthcheck`
The *-i* flag in the command above instructs curl to display the HTTP response headers as well as the response body.
### Result
HTTP/1.1 200 OK
Date: Mon, 05 Apr 2021 17:46:14 GMT
Content-Length: 58
Content-Type: text/plain; charset=utf-8
status: available
environment: development
version: 1.0.0