This is a simple RESTful API built with Go (Golang) using the Gorilla Mux router. It provides endpoints to manage movies, including retrieving all movies, retrieving a single movie by ID, creating a new movie, updating an existing movie, and deleting a movie.
-
Clone the repository:
git clone https://github.com/your-username/MovieManagementApi.git
-
Navigate to the project directory:
cd MovieManagementApi
-
Build the Go application:
go build
-
Run the executable:
./MovieManagementApi
- GET /movies: Retrieve all movies.
- GET /movies/{id}: Retrieve a single movie by ID.
- POST /movies: Create a new movie.
- PUT /movies/{id}: Update an existing movie.
- DELETE /movies/{id}: Delete a movie.
{
"id": "1",
"isbm": "438227",
"title": "Movie One",
"director": {
"firstname": "Ak",
"lastname": "Doe"
}
}
-
Retrieve all movies:
curl http://localhost:8000/movies
-
Retrieve a single movie by ID:
curl http://localhost:8000/movies/1
-
Create a new movie:
curl -X POST -H "Content-Type: application/json" -d '{"isbm": "123456", "title": "New Movie", "director": {"firstname": "John", "lastname": "Doe"}}' http://localhost:8000/movies
-
Update an existing movie:
curl -X PUT -H "Content-Type: application/json" -d '{"isbm": "123456", "title": "Updated Movie", "director": {"firstname": "Jane", "lastname": "Doe"}}' http://localhost:8000/movies/1
-
Delete a movie:
curl -X DELETE http://localhost:8000/movies/1
This project is licensed under the MIT License - see the LICENSE file for details.