mirror of
https://github.com/KevinMidboe/moviedb.git
synced 2025-12-08 04:18:51 +00:00
Support custom base_url
This commit is contained in:
@@ -10,8 +10,8 @@ var request = require('superagent')
|
||||
* Exports the constructor
|
||||
*/
|
||||
|
||||
module.exports = function(api_key){
|
||||
if(api_key) return new MovieDB(api_key);
|
||||
module.exports = function(api_key, base_url){
|
||||
if(api_key) return new MovieDB(api_key, base_url);
|
||||
else throw new Error('Bad api key');
|
||||
};
|
||||
|
||||
@@ -19,8 +19,9 @@ module.exports = function(api_key){
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function MovieDB(api_key) {
|
||||
function MovieDB(api_key, base_url) {
|
||||
this.api_key = api_key;
|
||||
if(base_url) endpoints.base_url = base_url;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user