CRUD

Server

cookbook/crud/server.go

  1. loading...

Client

Create user

Request

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

Response

  1. {
  2. "id": 1,
  3. "name": "Joe Smith"
  4. }

Get user

Request

  1. curl localhost:1323/users/1

Response

  1. {
  2. "id": 1,
  3. "name": "Joe Smith"
  4. }

Update user

Request

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

Response

  1. {
  2. "id": 1,
  3. "name": "Joe"
  4. }

Delete user

Request

  1. curl -X DELETE localhost:1323/users/1

Response

NoContent - 204