08.02.2017 Views

vuejs

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Preface 97<br />

As indicated in the above table, to get a listing with all the ‘stories’ we have to make an HTTP GET<br />

or HEAD request to api/stories. To update an existing story we have to make an HTTP PUT or<br />

PATCH request to api/stories/{storyID} providing the data we want to override, and replacing<br />

{storyID} with the id of the story we want to update. The same logic applies to all endpoints, I<br />

think you get the idea.<br />

Assuming your server is running on http://localhost:3000, you can view a listing of all stories<br />

in JSON format by visiting http://localhost:3000/api/stories on your web browser.<br />

Tip<br />

JSON response<br />

Reading raw JSON data on browser can be a pain . It is always easier to read a well<br />

formatted JSON. Chrome has some great extensions that could format raw JSON data<br />

into tree view format that can be easily read.<br />

I use JSONFormatter³ because it supports syntax highlighting and displays JSON in tree<br />

view where the nodes on the tree can be collapsed or expanded by clicking the triangle<br />

icon on the left of each node. It also provides a button for switching to original (raw) data.<br />

You can choose whichever extension you like but you should definitely use one!<br />

³https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!