This project is a simple application that facilitates CRUD operations (Create, Read, Update, Delete) for book data using the Go (Golang) programming language. It uses a JSON file for data storage, making it a great resource for learning backend development without the complexity of setting up a database.
.
âââ main.go # Main entry point of the application
âââ handler/ # HTTP request handlers
â âââ book.go
âââ model/ # Data structure definition for Book
â âââ book.go
âââ storage/ # Functions to read/write from JSON file
â âââ book.go
âââ data/
â âââ books.json # Book data storage file
âââ static/ # Static files (HTML, CSS, JS if needed)
Clone the repository:
git clone https://github.com/seaavey/crud-golang
cd crud-golang
Run the application:
go run main.go
Open your browser and go to:
http://localhost:8080
Method | Endpoint | Description |
---|---|---|
POST | /books |
Add a new book |
GET | /books |
Retrieve all book data |
GET | /books/{id} |
Retrieve a specific book by ID |
PUT | /books/{id} |
Update a book |
DELETE | /books/{id} |
Delete a book by ID |
{
"id": "1",
"title": "Learn Golang",
"author": "John Doe"
}
data/books.json
file.data/
folder or books.json
file does not exist, create it manually:
mkdir data
echo "[]" > data/books.json
This project is licensed under the MIT License â Š 2025 Muhammad Adriansyah