diff --git a/README.md b/README.md index 0264245..820129a 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,39 @@ See the [Node.js Request README][req] for several more examples. Request intends # Usage +## Browserify + +Browser Request is a [browserify][browserify]-enabled package. + +First, add `browser-request` to your Node project + + $ npm install browser-request + +Next, make a module that uses the package. + +```javascript +// example.js - Example front-end (client-side) code using browser-request via browserify +// +var request = require('browser-request') +request('/', function(er, res) { + if(!er) + return console.log('browser-request got your root path:\n' + res.body) + + console.log('There was an error, but at least browser-request loaded and ran!') + throw er +}) +``` + +To build this for the browser, run it throubh browserify. + + $ browserify --entry example.js --outfile example-built.js + +Deploy `example-built.js` to your web site and use it from your page. + +```html + +``` + ## Ender Browser Request is an [Ender][ender] package. If you don't have Ender, install it, and don't ever look back.