It is a simple and efficient web application built with Go (Golang) that demonstrates the basic CRUD (Create, Read, Update, Delete) operations for managing a list of movies. This project serves as a practical example for learning Go and building RESTful APIs.
- Backend: Go (Golang)
- Router: Gorilla Mux
- Version Control: Git
MovieCRUDAPI/
├── main.go
├── go.mod
├── go.sum
└── README.md
-
Clone the repository:
git clone https://github.com/ArjinAlbay/go-movies-crud.git cd go-movies-crud
-
Install the necessary dependencies:
go get -u github.com/gorilla/mux
To start the server, run:
go run main.go
The server will start at http://localhost:3000
.
- URL:
/movies
- Method:
GET
- Description: Retrieves all movies.
- URL:
/movies/{id}
- Method:
GET
- Description: Retrieves a movie by ID.
- URL:
/movies
- Method:
POST
- Description: Creates a new movie.
- Request Body:
- URL:
/movies/{id}
- Method:
PUT
- Description: Updates an existing movie by ID.
- Request Body:
- URL:
/movies/{id}
- Method:
DELETE
- Description: Deletes a movie by ID.
`
{
"id": "1",
"isbn": "4598",
"title": "The Lord of the Rings",
"director": {
"firstname": "Jack",
"lastname": "Jhones"
}
}
- Open your browser and navigate to
http://localhost:3000/movies
to see all movies. - Navigate to
http://localhost:3000/movies/{id}
to see a specific movie by ID.
Contributions are welcome! Please open an issue or submit a pull request for any improvements, bug fixes, or new features.
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature
) - Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.