UNPKG

atlasgql

Version:

A self-composing GraphQL server library using TypeScript, Express and Apollo Server

22 lines 775 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.registerCustomRoutes = void 0; const express_1 = require("express"); const automation_1 = require("../interfaces/automation"); const router = (0, express_1.Router)(); router.get('/types', (_req, res, _next) => { res.attachment('graphql.d.ts'); res.type('txt'); res.send(automation_1.InterfacesAutomation.blob); }); const normalizeRoutePath = (path) => { return path[0] !== '/' ? (path = `/${path}`) : path; }; const registerCustomRoutes = (routes) => { routes.forEach((route) => { router.get(normalizeRoutePath(route.path), route.handler); }); }; exports.registerCustomRoutes = registerCustomRoutes; exports.default = router; //# sourceMappingURL=rest.js.map