Generate random mocks on the fly and bind them to your REST resources
✓ user-friendly API
✓ fast to use
✓ flexible
click (multiple times) on any of the buttons on the left to fire $http
service calls
which will get handled by $httpBackend
service.
Because you want to concentrate on writing angular apps and not on generating mock data or even writing them by hand... and then configuring angular details to make them work.
This is an out-of-the-box solution that works immediately!
It enables you to do Backend-less development
angular-jsf
combines built-in angular
$httpBackend
service with JSON-Schema-faker
library.
Check out JSON-Schema-faker demo page to see schema examples!
1. Make sure you include required JS files:
angular-mocks
built-in module:
<script type="text/javascript" src="https://code.angularjs.org/1.4.0/angular-mocks.js"></script>
json-schema-faker
library:
<type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/json-schema-faker/0.3.1/json-schema-faker.min.js"></script>and
angular-jsf
:
<script type="text/javascript" src="angular-jsf.js"></script>
2. Use jsf
as dependency:
var demoApp = angular.module('demoApp', ['jsf']);
3. define mocks in module run
phase:
demoApp.run(function (jsfRegisterMock) { // GET /users/ jsfRegisterMock({ name: 'User Collection', url: '/users', method: 'GET', responseSchema: { "type": "object", "properties": { "name": { "type": "string", "faker": "name.findName" }, "email": { "type": "string", "faker": "internet.email" }, "age": { "type": "integer", "minimum": 0, "maximum": 100 } }, "required": [ "name", "email", "age" ] } });and be happy!
Keep in mind angular-jsf is in early development stage and the API might change in future versions.