Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 7, 2020 02:39 am GMT

Fake REST APIs That We Can Use to Build Prototypes

Subscribe to my email list now at http://jauyeung.net/subscribe/

Follow me on Twitter at https://twitter.com/AuMayeung

Many more articles at https://medium.com/@hohanga

Even more articles at http://thewebdev.info/

When we want to build prototypes, we want to build them fast. Therefore, we should find a fake REST API so that we dont need to write our own for a quick prototype.

In this article, well look at some fake REST APIs that we can use to mock out our back end for prototypes.

JSONPlaceholder

JSONPlaceholder is a useful REST API that lets us do CRUD operators on their server by sending requests to their REST API.

It supports CORS so that we can use them with our front end apps.

The endpoints follow the REST API convention so its also great examples for us to follow.

Therere a few endpoints like comments, photos, albums, todos, and posts that we can query and send.

Reqres

Reqres is a useful REST API to let us mock out our API for our front end.

It explicitly says that it supports Ajax requests so we can go ahead and use it with our front end directly.

Therere lots of routes that are available. They include GET, POST, PATCH, and DELETE routes.

Most of the routes are user-related routes, so we can fake an authentication system without building one ourselves.

typicode/json-server

The JSON server program is a Node package that we can run on our local computer.

We can define our routes by providing them with fake JSON data.

Therefore, we can create any route we like, unlike the previous examples.

Its very configurable and can be adapted to be used in any situation. It supports things like charging ports, HTTPS, custom routes, middleware, and more.

We can also serve static files with it. So its more comprehensive than the websites we have above.

Fake it till you make it

Fake it till you make it is another mock back end API that we can use to speed up our development.

It comes with both free and paid tiers, The paid tier have 1000 fake units a day with arrays up to 10 elements in size.

We can get one API token to use the free version.

The nesting depth is up to 1 level deep for the free version. The paid version lets us nest our JSON deeper.

Requests parameters are accepted in the paid version. And paid versions can have custom fields.

Support is also available for the paid versions via email.

Beeceptor

Beeceptor is another web app that lets us mock out a REST API. we can enter a name for our endpoint which is hosted in their subdomain.

It supports all kinds of requests like GET, POST, PUT, PATCH, and DELETE.

We can also simulate API responses and failures.

Payloads can be inspected for debugging purposes. Also, we can capture HTTP requests in real tine.

Other things it can do include A/B testing and simulate latencies and timeouts. These are all important things since we want to handle error cases in addition to successful cases.

Photo by Quentin Kemmel on Unsplash

Fake Rest

Fake Rest API is another fake API site. We can use them to mock out endpoints with data included.

Things like address, array, e-commerce data, and much more can all be retrieved right from this app.

We can also add our own data and use them whenever we like. We can specify any description for our endpoints including method name, verb, redirect, Content-Type , response code, and more.

ngduc/api-now

api-now is a Node package that we can run locally on our computer to create a fake API instantly.

It comes with default datasets. Also, it can take .json or .js file for data.

It has some routes like file upload, login, todos, images and more. The login route provides us with a JSON web token for authentication.

Also, it can serve files in a static directory. We just have to run npx api-now to run this package.

Mocky

Mocky is a simple app where we can enter the response we want to generate ourselves and get an endpoint for it on the fly.

We can use it to simulate responses with different status codes, body, and headers.

Conclusion

Therere many fake API apps that we can use to mock out our API for prototypes.

Some include data and some are more configurable. So we can take our pick and choose one thats right for us.


Original Link: https://dev.to/aumayeung/fake-rest-apis-that-we-can-use-to-build-prototypes-54dm

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To