Skip to content
This repository has been archived by the owner on Aug 21, 2022. It is now read-only.

Commit

Permalink
simplest-usage example updated
Browse files Browse the repository at this point in the history
  • Loading branch information
DScheglov committed Feb 20, 2017
1 parent f7c2056 commit cc144fd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions examples/simplest-usage/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,17 @@ Output:
Express server is listening on port 1337
```

To beautify the json presentation let's install js-beautify:
```shell
# use sudo if needed
npm install -g js-beautify
```


-----------------------------------------------------------
Calling API:
```shell
curl -X OPTIONS http://localhost:1337/api/v1/
curl -s -X OPTIONS http://localhost:1337/api/v1/ | js-beautify
```


Expand All @@ -97,7 +104,7 @@ Output:
----------------------------------------------
Posting new vector
```shell
curl -H "Content-Type: application/json" -X POST -d '{"x": 0, "y": 777}' http://localhost:1337/api/v1/vectors
curl -s -H "Content-Type: application/json" -X POST -d '{"x": 0, "y": 777}' http://localhost:1337/api/v1/vectors | js-beautify && echo
```

Output:
Expand All @@ -109,7 +116,7 @@ Output:
----------------------------------------------
Posting one more vector
```shell
curl -H "Content-Type: application/json" -X POST -d '{"x": -1, "y": 3}' http://localhost:1337/api/v1/vectors
curl -s -H "Content-Type: application/json" -X POST -d '{"x": -1, "y": 3}' http://localhost:1337/api/v1/vectors | js-beautify && echo
```
Output:
Expand All @@ -120,7 +127,7 @@ Output:
----------------------------------------------
Listing all vectors:
```shell
curl -g http://localhost:1337/api/v1/vectors
curl -s -g http://localhost:1337/api/v1/vectors | js-beautify && echo
```
Output:
```shell
Expand Down

0 comments on commit cc144fd

Please sign in to comment.