I love prototyping ideas to show others. Quickly making something tangible allows to seek feedback, evaluate the concept, and converge on something useful. The speed is paramount: I want to make something quick before the inspiration is gone, but the prototype should be good enough to get a fair judgement. Lately I have discovered a wonderful pair of tools that complement each other perfectly and allow me to get a functional website up and running in seconds. Ok, minutes.
Starts small Express-based REST server based on a JSON file, runs under nodejs. Install globally:
sudo npm install -g json-server
Then create a JSON file with a data collection issues.json:
Start the server
Claims to be a perfect fit for any WebApp that consumes data from a RESTful API. Just point it at json-server base url and use the returned objects, all wrapped in promises. CORS and JSONP are supported.
angular.module('project', ['restangular', 'ngRoute']).
The best feature of this pair is its simplicity. Compared to complete seed projects, such as ultimate-seed, there is almost no code to install, configure or update. Take a look at the example project I have created.
Single JSON file can host multiple collections like this:
json-server creates separate end point for each top level property
$ json-server combined.json
Suppose you need to generate initial test sets with fake data. A good module to use is Faker. It can generate lots of different types of fake records: from addresses to internet identities, etc. Json-server can use a function to generate data, so both modules work together nicely. I prefer generating and saving fake data to JSON file to have the same data between runs.
var R = require('ramda');
This generates a json file with 10 random people. Then we can start the json server