

Stubb: Build REST API mocks using your file system - knuton
https://github.com/knuton/stubb

======
breckinloggins
There's another application for this besides mocking: static REST routes.

For example, imagine if all github pages had this enabled. Then, by writing
the appropriate files, you could provide a REST interface to static assets in
an interesting way.

I can't quite, at the moment, come up with anything I would actually USE this
for, but it would be quite neat.

------
goldfeld
I was just writing some dumb hardcoded json mock code here and wondering when
my IIS-powered colleague will be available for us to test and implement the
proper requests. Then this comes in and allows me code an almost production-
ready frontend all by myself on my Microsoftless linux box--which I'll be
doing right away.

------
sktrdie
I don't get this. How do you handle POST/PUT/DELETE requests with files? It
doesn't say much about it in the README.

~~~
knuton
Well, this is only for stubbing an API, you don’t build an actual API, so
nothing in the filesystem is changed when you PUT, POST or DELETE.

What does change though is the state in the working memory, specifically in
the stubb server process, by means of which you can change the response by
using the response sequences described in the README. You might for example
test a client-side deletion procedure, so you specify a stalling response
sequence with two members. Your first DELETE request to /photos/5 will be
responded to with the content described in the first sequence member (say 200
OK), while all further requests will be responded to with the content
described in the second sequence member (say 404 NOT FOUND, using YAML
frontmatter for specifying the HTTP status).

------
protez
Kudos! This is a quite brilliant idea for building simple API prototypes.

------
blerrrgh
Well, I think that's rather rude. Why would it mock the use of my file system?

~~~
nvmc
That's okay, my filesystem will kill his wife.

