API not ready? No worries, Continue development with MOCK APIs

Why a Mock API?

  • No API yet: Straight forward, this means your API service is not ready by backend teams, but you need to design your web service as per APIs. Mocking allows you to rapidly prototype different potential response shapes to see how they work with your app.
  • Slow or unreliable API : We all know when the payload increase app service become very slow to give response payload, due to this front end development become slow or even halt or sometimes the existing web services go down, at this time a mock API allows you to keep working.
  • Work offline : Finally, maybe you need to work on a plane, on the road, or in other places where connectivity is poor. Mocking allows you to work offline because your calls remain local.
  • Eliminate inter-team dependencies : Is a separate team creating your app’s web services? A mock API means you can start coding immediately and switch to the real web services when they’re ready. Just agree on the API’s proposed design and mock it accordingly.

So, without any wait Let’s Create a Mock API

  • Create the schema
  • Get random data
  • Serve data
JSON schema Faker
var randomName = faker.name.findName(); 
var schema = {
"type": "object",
"properties": {
"name": {
"type": "string",
"faker": "name.findName"
"email": {
"type": "string",
"faker": "internet.email"
"required": [
module.exports = schema;
"generate-mock-data": "node generateMockData"
"start-mockapi": "json-server --watch src/api/db.json --port 3001"



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store