Last active
January 28, 2018 18:51
-
-
Save 4F2E4A2E/d8da9003f561762a6b4631efbeb2e5e1 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
const {GraphQLServer} = require('graphql-yoga'); | |
const swaggerGraphQLSchema = require('swagger-to-graphql'); | |
const API_BASE_URL = 'http://petstore.swagger.io/v2'; | |
swaggerGraphQLSchema('./schema/petstore.swagger.json') | |
.then(schema => { | |
const options = { | |
port: 4000 | |
}; | |
const server = new GraphQLServer({ | |
schema, | |
context: { | |
GQLProxyBaseUrl: API_BASE_URL | |
} | |
}); | |
server.start(options, () => console.log('Server is running on localhost:' + options.port)) | |
}) | |
.catch(e => { | |
throw e; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swagger v2 type file currently not supported. Save change the swagger file type definition into object or string like this: