-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·36 lines (36 loc) · 2.14 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·36 lines (36 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Fill with data
curl -H "Content-Type: application/json" -X POST -d '{"name": "(1) Top 10 ES6 Features", "url":"http://webapplog.com/es6", "text": ""}' "http://localhost:3000/posts"
curl -H "Content-Type: application/json" -X POST -d '{"name": "(2) 10 ES6 Features of whatever. ", "url":"http://webapplog.com/es6", "text": ""}' "http://localhost:3000/posts"
curl -H "Content-Type: application/json" -X POST -d '{"name": "(3) Groovy things whatever. ", "url":"http://webapplog.com/es6", "text": ""}' "http://localhost:3000/posts"
curl -H "Content-Type: application/json" -X POST -d '{"name": "(4) Top 4 ES6 Components of whatever. ", "url":"http://webapplog.com/es6", "text": ""}' "http://localhost:3000/posts" -iv
#pause for tester human
echo
read -p "Press any key to continue... " -n1 -s
echo
# Update:
curl -H 'Content-Type: application/json' -X PUT -d '{"name": "3 - Groovier Features Every Developer Must Know", "url":"http://webapplog.com/es6", "text": ""}' "http://localhost:3000/posts/2" -iv
# Get all:
curl "http://localhost:3000/posts" -iv
#pause for tester human
echo
read -p "Press any key to continue... " -n1 -s
echo
#Add a record with single comment:
#curl -H "Content-Type: application/json" -X POST -d '{"name": "Top 10 ES6 Features", "url":"http://webapplog.com/es6", "text": "", "comments": [ {"text": "This is a comment"} ]}' "http://localhost:3000/posts"
#Add a comment to an existing post--should work whether other comments exist or not:
curl -H "Content-Type: application/json" -X POST -d '{"text": "This is a comment"}' "http://localhost:3000/posts/0/comments"
#Display comments for existing post:
curl "http://localhost:3000/posts/0/comments"
#Update a record comment:
curl -H "Content-Type: application/json" -X PUT -d '{"text": "This is a replacement comment"}' "http://localhost:3000/posts/0/comments/0" -iv
#Delete a comment:
curl -H "Content-Type: application/json" -X DELETE "http://localhost:3000/posts/0/comments/0"
#Delete a post:
curl -H "Content-Type: application/json" -X DELETE "http://localhost:3000/posts/0" -iv
#pause for tester human
echo
read -p "Press any key to continue... " -n1 -s
echo
# Get all
curl "http://localhost:3000/posts" -iv
echo