interfake
interfake copied to clipboard
Fluent command-line interface
The JS interface for creating APIs is super easy and clear, but the command line interface can be a bit of a faff.
This:
$ interfake GET /thing 200 {"response":"whatever"} creates POST /other-thing 201 {"hey":"whatup"}
Should produce the same results aas this:
interfake.get('/thing').status(200).body({"response":"whatever"}).creates.post('/other-thing').status(201).body({"hey":"whatup"});
- [x] Support creating a single endpoint
- [x] Support
creates
- [ ] Support
extends
- [ ] Support
patch
Are there examples of node stuff having these fluent apis?
Not as far as I know. It's a bit weird, but I can't see why it shouldn't be possible. I played around with it a little bit a couple of weeks ago, and I think the process essentially needs a state machine which parses the input very similarly to how one would parse a programming language. I wouldn't be surprised if there's a node tool out there for parsing this sort of thing. Possibly Jison
I worked with state machines