Support custom base_url

This commit is contained in:
Brandon Mills
2013-06-02 15:59:08 -07:00
parent 1c65b9fd32
commit 6b2c62e297

View File

@@ -10,8 +10,8 @@ var request = require('superagent')
* Exports the constructor * Exports the constructor
*/ */
module.exports = function(api_key){ module.exports = function(api_key, base_url){
if(api_key) return new MovieDB(api_key); if(api_key) return new MovieDB(api_key, base_url);
else throw new Error('Bad api key'); else throw new Error('Bad api key');
}; };
@@ -19,8 +19,9 @@ module.exports = function(api_key){
* Constructor * Constructor
*/ */
function MovieDB(api_key) { function MovieDB(api_key, base_url) {
this.api_key = api_key; this.api_key = api_key;
if(base_url) endpoints.base_url = base_url;
return this; return this;
} }