Photo on Unsplash

Hey folks, when you are working on Front end technologies like ReactJS or Angular, you may also depend on server side code like NodeJS or Spring Framework and also complex database queries. This is cumbersome as you will have to develop both back end code and front end code, but your main focus is on the client side. Of course there can be back end developers. But what if the back end is not ready. What to do now? Do you really wanna proceed or give up? Let’s see..

Use something like JSON Placeholder to solve your problem. This is good. But you can not find your requirements exactly. Search for back end APIs in GitHub to avoid back end coding. This is also nice. But why should I care and search, when I’m curious about Front end. So, anything else available?

stubby4node is the excellent npm package. No matter what back end developer your are, It is very simple to setup and their documentation says

You just need a single YAML or JSON file to configure the endpoint descriptors.

Like the above configuration, you can add any number of endpoints and their responses with different statuses. This simple package can save lot of your development time. As I mentioned above, you can write a shell script file to automate the start/stop of stubs. Below is the shell script file, I always use.

The above script runs the mock server on port 8081 and admin portal on 5558(defaults to 8889). You can run the stubs programmatically also, as like given below.

var Stubby = require('stubby').Stubby;var stubby1 = new Stubby();var stubby2 = new Stubby();stubby1.start({  stubs: 80,  admin: 81,  location: 'localhost',  data: [{    request: { url: "/anywhere" }  },{    request: { url: "/but/here" }  }]  });  stubby2.start({    stubs: 82,    admin: 83,    location: '127.0.0.2'  });

With this, you can explore front end technologies without worrying about back end code and database maintenance. What can I do with it, you ask? It has a great documentation, which you can take a look and you have to. It is integrated with other languages such as Java, .NET, grunt and gulp. So, I hope it helps. Thank you guys for reading.

24 y/o Software Developer. I work with Java, Spring Boot, React, Node, PostgreSQL and AWS