HTTP service
- Open directory
cd /root/automation-technology/chapter02-microservices/2.2-microservices-types/01-http-service
- Run command to init project
go mod init automationworkshop/main
go mod tidy
- Run command to build project
go build .
- Run program
./main
- Run command
curl -X POST "localhost:8080/citizen"
{"status":"success"}
- Run command
curl -X PUT "localhost:8080/citizen/123"
{"id":"123"}
- Run command
curl -X GET "localhost:8080/citizen/123?page=2"
{"id":"123","page":"2"}
- Run command
curl -X DELETE "localhost:8080/citizen/123"
{"status":"success"}
- Explain the service in source code