Answer the question
In order to leave comments, you need to log in
How to test a backbone application if the API services are not yet fully ready or there are none?
Good afternoon!
We have an application html/css/javascript/backbone/gulp and so on. There is an agreement on the API, but it is not yet fully written. The question is, is it possible to emulate the server somehow? are there any utilities for this?
For example, what would the server always give one response to the same request.
Answer the question
In order to leave comments, you need to log in
The easiest thing is to change the URL to some local one and put a set of JSON files there. Voila!
If you are using jQuery then the best way is to use the jquery-mockjax plugin . It allows you to flexibly emulate the server API.
I like this thing, very simple
https://github.com/typicode/json-server
In fact, it can be even simpler - just redefine Backbone.sync with your own function for the duration of the tests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question