The Newque Node.js driver the design of which is inspired heavily by Newque.
npm install @bradstimpson\newque-nodejs
This assumes that the channel has been configured as httpFormat=json:
// Send an HTTP POST request to writenewque({protocol: 'http',method: 'write',url: 'localhost:8000/v1',channel: 'example',messages: {'Fred','Flintstone','Rocks!'}}).then(function(response){console.log(response);}).catch(function(error){console.log(error);});// Send an HTTP GET request to countnewque({protocol: 'http',method: 'count',url: 'localhost:8000/v1',channel: 'example'}).then(function(response){console.log(response);}).catch(function(error){console.log(error);});// Send an HTTP GET request to read newque({protocol: 'http',method: 'read',url: 'localhost:8000/v1',channel: 'example',mode: 'one'}).then(function(response){console.log(response);}).catch(function(error){console.log(error);});The data types that can be sent with Newque are:
// messages can be sent as a request body
// only applicable request methods 'POST', 'PUT', and 'PATCH' (all resolve to 'POST'
// - string, plain object
// - stream, Buffer
npm test
npm run lint
npm run cover
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
