Testing the APIs using POSTMAN
The API endpoint we created (http://localhost:3300/greetings) is a GET
method request type API call and it is quite easy to test the API endpoint directly in the browser URL locator. This is because when you hit any URL input from the browser URL locator directly, by default it performs a GET
method request. So what about the POST
, PUT
, or DELETE
request methods? Definitely, the browser is able to make those requests but not by default or through any direct input in the URL locator but by using AJAX requests or FORM POST requests.
In such cases, if we have created an API server and now we want to test our URL endpoint for sanity with respect to other request methods, we can't do it directly. Either we need to write some JavaScript code at the client side to make those API calls or use a REST client such as POSTMAN that can make API calls for us.
Testing hapi server APIs using POSTMAN
Let us install POSTMAN for our use case of the hapi
server APIs and test it....