When building any project, you may need to talk to some end-point and to get some JSON to display on your webpage. In development, how do you go about this? One option might be to save the JSON to your local disk and then read it in. This approach is less than ideal, as you'll have to write code to parse it. In this article, I will cover some of the different approaches you can take to tackle this problem.
If you have never come across MyJson then I suggest you check it out, from here.
The MyJson website is a really handy tool to have in your toolbelt, to help you start talking to an API quickly. Simply paste your JSON into MyJson, click Save and you'll be given a URL you can then use. If you are using a package - like isomorphic-fetch - it's then just a matter of writing your callback code and off you go.
When writing new sites and the Node APIs are still in flux, this is a super-simple and quick way to help you get going.
MyJson will help you get started quickly, however, just because your code returns something it doesn't mean it works. On this site over the years, I've written a lot about the benefits of unit testing, so I won't cover the same grounds.
When I'm building something I will usually always start with writing tests sooner rather than later. In JS I found this the easiest way to debug my code it's a no-brainer for me to mock my service and pass some data into it. If you are new to JS testing and you do not know where to start, I suggest you check out: