paypro: example - document modular usage of example.

This commit is contained in:
Christopher Jeffrey 2014-08-18 14:44:06 -07:00
parent 76092fb1a3
commit 774dacae8d
2 changed files with 12 additions and 4 deletions

View File

@ -65,3 +65,10 @@ testnet coins, you can pass `--no-tx` on the server command line.
If you don't want the tests to run automatically and simply host the payment
server, simply pass `--browser` (`-b`) as mentioned above.
## Using the example in a modular manner
``` js
var server = require('bitcore/examples/PayPro');
server.listen(8080);
```

View File

@ -48,8 +48,10 @@ var server = https.createServer({
cert: fs.readFileSync(__dirname + '/../../test/data/x509.crt')
});
server.options = argv;
server.setOptions = function(options) {
argv = options;
server.options = argv = options;
};
var app = express();
@ -411,10 +413,9 @@ server.port = 8080;
server.isNode = true;
setTimeout(function() {
server.port = +argv.p || +argv.port || 8080;
server.port = argv.p = argv.port = +argv.p || +argv.port || 8080;
server.isNode = !argv.b && !argv.browser;
// Arguably the same thing as -b or --browser:
if (argv.s || argv.server) {
if (argv.s || argv.server || argv.l || argv.listen) {
server.listen(server.port, function(addr) {
print('Listening on port %s.', server.port);
});