apiculator
Mock JSON API tool for Node, using:
Directories specify routes; files specify methods
api
└── get.json
Will respond to any GET request to '/' with the JSON in the file.
Header tags give the client control
api
└── session
├── post.json
└── post+bad.json
Generally, if the client POSTs to '/session' then post.json
is the response.
However, if the client POSTs to '/session' with the HTTP header X-APICULATOR-TAGS: bad
, then the post+bad.json
is the response.
Babelon templates and helpers for terse JSON
api
└── users
└── get.babelon
> api/user/get.babelon
ok: true users: _
Rules for when you need them
api
└── gatekeeper
└── _rules.babelon
> api/gatekeeper/_rules.babelon
// correct password request: bodypassword === 'secret' response: status: 302 redirect: '/users' // catches all other requests (wrong password) response: json: ok: false
Raw Express route handlers
api
└── express
└── get.js
> api/express/get.js
module { res; }