Created
February 11, 2015 22:01
-
-
Save fehguy/2b144c8f90c3f9f0f2d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package.json: | |
{ | |
"dependencies": { | |
"swagger-client": "2.1.2-M1" | |
} | |
} | |
test.js: | |
var swagger = require('swagger-client'); | |
var api = new swagger.SwaggerClient(); | |
swagger.authorizations.add('api_key', new swagger.ApiKeyAuthorization('api_key', 'special-key', 'header')); | |
api.initialize({url: 'http://petstore.swagger.io/v2/swagger.json', success: function () { | |
api.pet.getPetById({petId: 1}, function (data) { | |
console.log(data.obj); | |
}) | |
}}) | |
// to run: | |
node test.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment