Test your front end with Mocky - A free tool to create dummy endpoints.

Test your front end with Mocky - A free tool to create dummy endpoints.

Welcome to this section of my technical writings. In this guide, we are going to set up a quick mocker back en server to test our API.

Are you learning HTTP requests and need a back-end server to experiment with? Are you building a web or mobile app that is expected to consume data from an endpoint but the endpoint is not yet ready?

This simple guide gets you started with Mocky.

Designer dashboard.

Follow the link to mocky.io , you will be lead to the designer dashboard.

MockyOne.png

Dashboard options

On the top right of the dashboard are two buttons. The two buttons are used to manage mocks or create a new mock.

buttons.png

The blue button.

Click on the 'new mock' button - the blue button- to create a new mock. Make the following configurations. (These are mostly set as default.)

  • HTTP Status - set to 200

  • Response Content Type - application/json

conf.png

Response Body

The response body is what will be returned when you make a GET request to the URL endpoint that will be provided. In this case, we are going to keep it very simple and send a simple user profile object as a response.

{
"name": "Odero Oluoch",
"company": "Andishi Africa",
"blog": "www.andishi.africa",
"location": "Nairobi",
"bio": "Software Developer. "
}

Add these details in the response body section in the dashboard as shown in the image below.

Ode.png

Final step

To keep this simple, we are going to leave the secret keys blank when creating the endpoint. Click on the 'GENERATE MY HTTP RESPONSE' button to get your URL endpoint.

final.png

Getting the mock URL endpoint

You will be lead to a screen view where you will get to see your mock URL.

Ode1.png

Test with Postman.

This is the mock URL we have generated.


https://run.mocky.io/v3/5c74bfac-c04d-48f3-aa51-d1fdc5086bc4

Feel free to test with Postman, or try to integrate it to load data to your fronted. Cheers and happy coding.

Follow this guide to make use of the API