DEV Community

Bervianto Leo Pratama
Bervianto Leo Pratama

Posted on • Originally published at berviantoleo.Medium on

Fake REST for Helping you to Test

It’s easy to start and great functional

Sometimes, not sometimes, but usually, we need to have parallel task between Front-end development and Back-end development. Oh no, the Front-end team need to know the Request/Response object that expected to know. Yeah, that context will usual meet in the project. It will best if we have the actual services, but sometimes it’s impossible to have or implement that in short time. So, we need to another alternatives to help Front-end team, so they don’t need to wait.

Mock API

We usually ended the solution with Mock API. At least the Front-end team know what is the request object and the response object. Is it will bring json, xml, or files? That’s why we need Mock API. But, yeah, we need the Mock API that no need take long time to build and no need much code to write. We can say that, we need effortless solution. If we still write many codes (I mean, too much effort) just for Mock API, I want to say that, it is useless and better we create the solution directly.

Simple REST API (Mock)

I found a solution that I think it’s good for simple REST API and just need the CRUD (Create, Read, Update and Delete). You can check here.

My JSON Server

I am not really sure if that service will reliable, but at least you can use it for short time, and the important things is effortless. But, please take care, since this is public services, make sure you not store any confidential data. You can check the guidance. If you need locally or private solution, you can use Json Server. It is easy to setup. Since the SaaS (Software as a Service), the My JSON Server is public services, I recommend you to setup the Json Server if you really need to be private and have some confidential data (but still not recommend to store this kind of data, better just reasonable dummy data). The disadvantage of this kind Mock API, it’s only support json (when I write this article) for request and response, but good enough if we need the simple REST API.

Postman API

I think this is quite good solution or alternative to create mock API. Please refer this documentation for how to create the Mock API.

Create New API

I think this is really good solution if you need complex request/response of the API. You can define the collections for request/response, give the description. You can create the documentation also! I want to recommend you to use this features. Somehow, yeah, you can do many things in here.

Happy Exploring!

Photo by Aziz Acharki on Unsplash

I just want to say Happy Exploring! I only want to recommend some tools/services that will help you to create the Mock API. So at least you can bring some “contract” to Front-end teams. If you have another solutions or alternatives, feel free to add and comment here.

I just want to say Happy Exploring! I only want to recommend some tools/services that will help you to create the Mock API. So at least you can bring some “contract” to Front-end teams. If you have another solutions or alternatives, feel free to add and comment here.

Top comments (1)

Collapse
 
boxpiperapp profile image
BOX PIPER

Great write up mate! 🤝
You can find such public apis at: jsonapi.co/public-api and mock servers at jsonapi.co/json-server
Keep writing!