# Golang CRUD Operations with Hardcoded Data
This repository demonstrates basic CRUD (Create, Read, Update, Delete) operations in Golang using hardcoded data.
It provides a simple example to understand how to implement these operations in a Golang application.
## Project Structure
- `main.go`: The main Golang file containing the CRUD operations.
- `README.md`: Documentation explaining the purpose and usage of the project.
## Prerequisites
Make sure you have Golang installed on your machine. If not, follow the instructions on the [official Golang website](https://golang.org/doc/install).
-
Clone the repository:
git clone https://github.com/EuclidStellar/CRUD-API-Go/
-
Navigate to the project folder:
cd CRUD-API-Go
-
Run the application:
go run main.go
-
Open your web browser and access the following endpoints:
- List all movies: http://localhost:8000/movies
- Get a specific movie by ID: http://localhost:8000/movies/{id}
- Create a new movie: Send a POST request to http://localhost:8000/movies with a JSON payload.
- Update a movie by ID: Send a PUT request to http://localhost:8000/movies/{id} with a JSON payload.
- Delete a movie by ID: Send a DELETE request to http://localhost:8000/movies/{id}.
curl -X POST -H "Content-Type: application/json" -d '{"id": "6", "title": "New Movie", "year": "2023", "director": {"firstname": "John", "lastname": "Doe", "age": 40}}' http://localhost:8000/movies
curl -X PUT -H "Content-Type: application/json" -d '{"id": "6", "title": "Updated Movie", "year": "2023", "director": {"firstname": "John", "lastname": "Doe", "age": 40}}' http://localhost:8000/movies/6
curl -X DELETE http://localhost:8000/movies/6
To run the project locally, make sure you have Golang installed. Follow these steps:
-
Clone the repository:
git clone https://github.com/EuclidStellar/CRUD-API-Go/
-
Navigate to the project folder:
cd CRUD-API-Go
-
Run the application:
go run main.go
-
Access the endpoints as described in the "Getting Started" section.
Contributions are welcome! If you have improvements, suggestions, or bug fixes, feel free to open an issue or create a pull request.
This project is licensed under the MIT License.
Customize the content further based on your repository's specifics.