This is a really nice approach to the problem of getting fake data. For the lazy, it responds with your request data if you have any. Super useful if you just want to get parsing with a real response.
I'd like to point out though, as I always do when things like this, I'm in the maintainer of a similar project which isn't hosted but is an open source node project: http://github.com/basicallydan/interfake - if you wanna do a similar thing but make responses more explicit. About the same amount of work up front, but you don't specify responses in requests.
Likewise, made a brutally simple fake REST API in response to a HN thread a few months back. Mine isn't nearly as configurable as interfake but it is quicker to set up "basic" REST resources. https://github.com/couchand/fake-api-server
I've been looking for something like interfake for a few weeks, so thanks for creating it! We've just been loading JSON from the file-system directly, but this will be much much nicer :)
This is a good idea. But I prefer to building a local mock server for my client-side ajax support. There so many tools you can use so it's not a complicated task. Usually, I use Grunt to build a local server to response mock data to requests.
Imagine the frontend and backend teams are large and do not work closely. This allows the frontend to easily test their code without waiting for the backend team to implement the specific api. Even better that it allows them to test with actual http request/responses instead of just hardcoding data.
Would be nice to be able to customize keys, choose a format for a list of a resource, etc. so that if you use this in development you don't need to make changes for your "real" API if you have different standards.
I'd like to point out though, as I always do when things like this, I'm in the maintainer of a similar project which isn't hosted but is an open source node project: http://github.com/basicallydan/interfake - if you wanna do a similar thing but make responses more explicit. About the same amount of work up front, but you don't specify responses in requests.
Anyway, nice one Ben!