Skip to main content

CRUD

Server

cookbook/crud/server.go
loading...

Client

Create user

Request

curl -X POST \
-H 'Content-Type: application/json' \
-d '{"name":"Joe Smith"}' \
localhost:1323/users

Response

{
"id": 1,
"name": "Joe Smith"
}

Get user

Request

curl localhost:1323/users/1

Response

{
"id": 1,
"name": "Joe Smith"
}

Update user

Request

curl -X PUT \
-H 'Content-Type: application/json' \
-d '{"name":"Joe"}' \
localhost:1323/users/1

Response

{
"id": 1,
"name": "Joe"
}

Delete user

Request

curl -X DELETE localhost:1323/users/1

Response

NoContent - 204