-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f7944b
commit f18b183
Showing
6 changed files
with
81 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
"nyc": "^11.3.0" | ||
}, | ||
"dependencies": { | ||
"figlet": "^1.2.0", | ||
"through2": "^2.0.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
'use strict' | ||
|
||
let httpDefaultOptions = { | ||
method: 'GET', | ||
hostname: 'api.mistdb.com', | ||
port: 5000, | ||
const https = require('https') | ||
|
||
const apiHostnameList = [ | ||
'api.mistdb.com', | ||
'api.mistdb.caltech.edu' | ||
] | ||
|
||
const httpsDefaultOptions = { | ||
headers: {}, | ||
agent: false | ||
} | ||
|
||
module.exports = | ||
class NodeMist3 { | ||
constructor(options) { | ||
this.httpOptions = options ? options : httpDefaultOptions | ||
this.httpsOptions = options ? options : httpsDefaultOptions | ||
} | ||
|
||
init() { | ||
httpsDefaultOptions.method = 'HEAD' | ||
const requests = [] | ||
for (const apiHostname of apiHostnameList) { | ||
httpsDefaultOptions.hostname = apiHostname | ||
requests.push(https.request(httpsDefaultOptions)) | ||
} | ||
return Promise.all(requests).then((responses) => { | ||
for (const response of responses) { | ||
console.log(response.statusCode) | ||
} | ||
return | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
const chai = require('chai') | ||
const chaiAsPromised = require('chai-as-promised') | ||
|
||
chai.use(chaiAsPromised) | ||
|
||
const expect = chai.expect | ||
const should = chai.should() | ||
|
||
const NodeMist3Abstract = require('./NodeMist3Abstract') | ||
|
||
describe.only('NodeMist3Abstract', function() { | ||
it('init should work', function() { | ||
const abstract = new NodeMist3Abstract() | ||
return abstract.init() | ||
}) | ||
}) |