Created
May 1, 2015 16:59
-
-
Save ponelat/534088a33ab5656cea7d to your computer and use it in GitHub Desktop.
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
var client = require('swagger-client'); | |
var swagger = new client({ | |
url: 'http://petstore.swagger.io/v2/swagger.json', | |
success: function() { | |
swagger.apis.pet.getPetById({petId:10},function(pet){ | |
console.log('pet', pet); | |
}); | |
} | |
}) |
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
// Output from running js-readme-node.js | |
// ..having assigned a pet with ID = 10 | |
pet { url: 'http://petstore.swagger.io/v2/pet/10', | |
method: 'GET', | |
headers: | |
{ 'access-control-allow-origin': '*', | |
'access-control-allow-methods': 'GET, POST, DELETE, PUT', | |
'access-control-allow-headers': 'Content-Type, api_key, Authorization', | |
'content-type': 'application/xml', | |
connection: 'close', | |
server: 'Jetty(9.2.7.v20150116)' }, | |
obj: {}, | |
status: 200, | |
statusText: undefined, | |
data: undefined } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment