-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme
More file actions
29 lines (23 loc) · 1.71 KB
/
readme
File metadata and controls
29 lines (23 loc) · 1.71 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
------------------------------------------------------------------
#commands for run server
------------------------------------------------------------------
mongod --dbpath <path>
node test/auth.js
node server.js
For tests use: httpie
------------------------------------------------------------------
#check post/get/put/delete requests
------------------------------------------------------------------
http POST http://localhost:1337/api/articles title=TestArticle author='John Doe' description='lorem ipsum dolar sit amet' images:='[{"kind":"thumbnail", "url":"http://habrahabr.ru/images/write-topic.png"}, {"kind":"detail", "url":"http://habrahabr.ru/images/write-topic.png"}]'
http http://localhost:1337/api/articles
http http://localhost:1337/api/articles/52306b6a0df1064e9d000003
http PUT http://localhost:1337/api/articles/52306b6a0df1064e9d000003 title=TestArticle2 author='John Doe' description='lorem ipsum dolar sit amet' images:='[{"kind":"thumbnail", "url":"http://habrahabr.ru/images/write-topic.png"}, {"kind":"detail", "url":"http://habrahabr.ru/images/write-topic.png"}]'
http DELETE http://localhost:1337/api/articles/52306b6a0df1064e9d000003
------------------------------------------------------------------
# add new users and check authorization
------------------------------------------------------------------
#command: node test/auth.js
#CHECK AUTHORIZATION
http POST http://localhost:1337/oauth/token grant_type=password client_id=mobileV1 client_secret=1234567 username=nikolai password=password
http POST http://localhost:1337/oauth/token grant_type=refresh_token client_id=mobileV1 client_secret=abc123456 refresh_token=TOKEN
http http://localhost:1337/api/userinfo Authorization:'Bearer TOKEN'