Skip to content

Instantly share code, notes, and snippets.

@kazagkazag
Created April 26, 2018 19:31
Show Gist options
  • Save kazagkazag/ccd70734758625e5b24486428d9b7fca to your computer and use it in GitHub Desktop.
Save kazagkazag/ccd70734758625e5b24486428d9b7fca to your computer and use it in GitHub Desktop.
# fetch articles for user with ID "myUserId"
curl --verbose -X GET "http://localhost:4000/users/myUserId/articles"
# response:
# [{"title":"qui vero quo enim error","content":"...","createdAt":"2018-04-26T05:50:26.130Z"}, ...]
# try to register user with valid user name
curl --verbose -X POST http://localhost:4000/register -H 'content-type: application/json' -d '{"userName":"valid"}'
# response:
# ...
# < HTTP/1.1 200 OK
# try to register user with invalid user name
curl --verbose -X POST http://localhost:4000/register -H 'content-type: application/json' -d '{"userName":"invalid"}'
# response:
# ...
# < HTTP/1.1 400 Bad Request
# ...
# {"message":"Invalid user name."}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment