Created
June 21, 2020 10:22
-
-
Save re4388/b1e4e408ef0d79977b3b29d63da8a7fc to your computer and use it in GitHub Desktop.
curl-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // POST reqest to add the first post | |
| curl --header "Content-Type: application/json" \ | |
| --request POST \ | |
| --data "{\"id\":\"1\",\"title\":\"this title\",\"text\":\"this is text\",\"categories\":\"cat\"}" \ | |
| http://localhost:3000/posts | |
| // POST reqest to add the second post | |
| curl --header "Content-Type: application/json" \ | |
| --request POST \ | |
| --data "{\"id\":\"2\",\"title\":\"this second title\",\"text\":\"this is second text\",\"categories\":\"dog\"}" \ | |
| http://localhost:3000/posts | |
| // GET request to check the result | |
| curl --request GET http://localhost:3000/posts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment