lib-http-api
install
npm install --save lib-http-api
usage
define an interface
var search = method : 'GET' route : '/search/:query' options: limit: 100 order: 'asc' ;
create the api
var API = ;var api = API; api;
create the client request
api;// { path : '/search/spicy+noodles?order=desc&limit=100',// method : 'GET',// host : 'localhost',// port : 100 }
switch off a server request
api;// { handle: 'search',// params: { query: 'spicy+noodles' },// query: { order: 'desc', limit: '100' } }
You'll want to associate the tokens returned with route handlers.