How to Mock APIs?. Do you want to start coding before your… | by 4kCode - The Legend of Hanuman

How to Mock APIs?. Do you want to start coding before your… | by 4kCode


4kCode

Do you want to start coding before your backend team finishes their work. Now it is easier than ever. There is a loose boundary between the backend and frontend team and it can be even useful to separate them as different parts of a project. We can, for instance, think of the backend as a provider of a RESTful API with a different functioning than frontend. This can help when we want just to deploy frontend to production or we want to use the same backend for another project with a different tech stack.

Therefore, in development phase teams work in frontend and backend. The backend team needs to assure that the content that API is providing is accurate whereas the frontend team needs the dummy data to be in the correct structure. Now we have to agree on JSON structure to be able to make both teams work independently.

How would be that possible?

Well, there are different ways to mock a backend and some of them are as follows:

  • Static JSON files via Ajax. This approach allows you to create your dummy data and store it inside the file system of your frontend project.
  • Online mocking services. These are dedicated service that offer solutions to help you mock HTTP responses with ease. (mocky.io )
  • JSON Server, this is a command line tool that is super easy to use and lets you serve JSON from the file system via a local server.
  • An own server. Even though it sounds like overengineering you can write your own server to be independent of the backend.
  • Frontend and backend teams can start working without hassle
  • Building mock APIs process is faster and easier to implement for developers
  • Reduces development time, since developers are not reliant on the other developer to start working.

Nowadays the development environment is changing and development time is of the utmost importance. Teams are thriving to find solutions that reduce their development time and it seems that using mock APIs to reduce frontend and backend teams time is very helpful.

Do you need to implement mock APIs? Contact us for more details and resources.


Share this content:

I am a passionate blogger with extensive experience in web design. As a seasoned YouTube SEO expert, I have helped numerous creators optimize their content for maximum visibility.

Leave a Comment