Mock API

Date: November 2020

image

You are a Frontend Developer and you need API to get json data from a server to make your front-end app alive. But you don't always need a real web service to test your app. You can mock(or fake) an API.

Why Mock API

Here are some reasons to use Mock API

  1. No real working API: When the Front-end and Back-end teams are working parallelly, there is no finished API to give data to front-end. So front-end requires dummy data to build your UI against. So mock API allows you to begin development without waiting for the API team to build the services.

  2. API call limit: There could be hourly/daily call limits OR API calls can be sometimes expensive to call repeatedly. So, it offers consistent, instantaneous responses to test UI.

  3. Work Offline: If you have internet issues, your app would still work given that it is mocking data locally.

Lets Create a Mock API

Bingo! your own API is ready to serve json data to your frontend.

Thank you for reading.