UNPKG

@getanthill/datastore

Version:

Event-Sourced Datastore

34 lines 1.18 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const express_1 = __importDefault(require("express")); const express_graphql_1 = require("express-graphql"); const openapi_to_graphql_1 = require("openapi-to-graphql"); async function routes(services, oas) { const app = express_1.default.Router(); const { schema } = await (0, openapi_to_graphql_1.createGraphQLSchema)({ ...oas, servers: [ { description: 'API Server', url: `http://localhost:${services.config.port}/api`, }, ], }, { /** * @see https://github.com/IBM/openapi-to-graphql/tree/master/packages/openapi-to-graphql */ operationIdFieldNames: true, ...services.config.graphql.openApiToGraphQL, }); app.use((0, express_graphql_1.graphqlHTTP)({ schema, graphiql: false, ...services.config.graphql.http, })); return app; } exports.default = routes; //# sourceMappingURL=index.js.map