A simple REST API built using Go standard library (net/http) with in-memory storage.
This project is made for learning backend development in Go step-by-step.
- Health check endpoint
- Create user (POST)
- List users (GET)
- Get user by ID (GET)
- Update user by ID (PUT)
- Delete user by ID (DELETE)
go-user-api/
├── handler/
├── model/
├── store/
├── main.go
├── go.mod
└── README.md
go run main.goServer runs on: http://localhost:8080
curl.exe http://localhost:8080/healthExpected response: OK
curl.exe -X POST http://localhost:8080/users -H "Content-Type: application/json" -d "{\"name\":\"Tejas\",\"email\":\"t@gmail.com\"}"Expected response: {"id":1,"name":"Tejas","email":"t@gmail.com"}
curl.exe http://localhost:8080/usersExpected response: [{"id":1,"name":"Tejas","email":"t@gmail.com"}]
curl.exe http://localhost:8080/users/1Expected response: {"id":1,"name":"Tejas","email":"t@gmail.com"}
curl.exe -X PUT http://localhost:8080/users/1 -H "Content-Type: application/json" -d "{\"name\":\"Updated Name\",\"email\":\"updated@gmail.com\"}"Expected response: {"id":1,"name":"Updated Name","email":"updated@gmail.com"}
curl.exe -X DELETE http://localhost:8080/users/1Expected response: User deleted successfully