File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,39 @@ See the [Node.js Request README][req] for several more examples. Request intends
67
67
68
68
# Usage
69
69
70
+ ## Browserify
71
+
72
+ Browser Request is a [ browserify] [ browserify ] -enabled package.
73
+
74
+ First, add ` browser-request ` to your Node project
75
+
76
+ $ npm install browser-request
77
+
78
+ Next, make a module that uses the package.
79
+
80
+ ``` javascript
81
+ // example.js - Example front-end (client-side) code using browser-request via browserify
82
+ //
83
+ var request = require (' browser-request' )
84
+ request (' /' , function (er , res ) {
85
+ if (! er)
86
+ return console .log (' browser-request got your root path:\n ' + res .body )
87
+
88
+ console .log (' There was an error, but at least browser-request loaded and ran!' )
89
+ throw er
90
+ })
91
+ ```
92
+
93
+ To build this for the browser, run it throubh browserify.
94
+
95
+ $ browserify --entry example.js --outfile example-built.js
96
+
97
+ Deploy ` example-built.js ` to your web site and use it from your page.
98
+
99
+ ``` html
100
+ <script src =" example-built.js" ></script > <!-- Runs the request, outputs the result to the console -->
101
+ ```
102
+
70
103
## Ender
71
104
72
105
Browser Request is an [ Ender] [ ender ] package. If you don't have Ender, install it, and don't ever look back.
You can’t perform that action at this time.
0 commit comments