@orion-js/http
Advanced tools
Comparing version 3.0.0-alpha.20 to 3.0.0-alpha.23
@@ -26,3 +26,3 @@ "use strict"; | ||
function registerRoute(route) { | ||
const app = (0, start_1.getApp)(); | ||
const app = route.app || (0, start_1.getApp)(); | ||
const method = route.method; | ||
@@ -29,0 +29,0 @@ const handler = async (req, res) => { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const express_1 = __importDefault(require("express")); | ||
const appRef = {}; | ||
global.appRef = null; | ||
const startServer = (port = Number(process.env.PORT)) => { | ||
@@ -17,8 +17,8 @@ const app = (0, exports.getApp)(); | ||
const getApp = () => { | ||
if (appRef.app) | ||
return appRef.app; | ||
if (global.appRef) | ||
return global.appRef; | ||
const app = (0, express_1.default)(); | ||
appRef.app = app; | ||
global.appRef = app; | ||
return app; | ||
}; | ||
exports.getApp = getApp; |
@@ -28,4 +28,8 @@ import express from 'express'; | ||
resolve: (req: express.Request, res: express.Response, viewer: any) => Promise<RouteResponse> | Promise<void>; | ||
/** | ||
* Pass another express app | ||
*/ | ||
app?: express.Application; | ||
} | ||
export interface Route extends OrionRouteOptions { | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setGetViewer = exports.getViewer = void 0; | ||
let getViewerRef = () => null; | ||
global.getViewerRef = () => null; | ||
const getViewer = async (req) => { | ||
try { | ||
const viewer = await getViewerRef(req); | ||
const viewer = await global.getViewerRef(req); | ||
if (!viewer) | ||
@@ -18,4 +18,4 @@ return {}; | ||
const setGetViewer = (getViewerFunc) => { | ||
getViewerRef = getViewerFunc; | ||
global.getViewerRef = getViewerFunc; | ||
}; | ||
exports.setGetViewer = setGetViewer; |
{ | ||
"name": "@orion-js/http", | ||
"version": "3.0.0-alpha.20", | ||
"version": "3.0.0-alpha.23", | ||
"main": "lib/index.js", | ||
@@ -19,5 +19,5 @@ "types": "lib/index.d.ts", | ||
"dependencies": { | ||
"@orion-js/helpers": "^3.0.0-alpha.11", | ||
"@orion-js/resolvers": "^3.0.0-alpha.20", | ||
"@orion-js/schema": "^3.0.0-alpha.13", | ||
"@orion-js/helpers": "^3.0.0-alpha.23", | ||
"@orion-js/resolvers": "^3.0.0-alpha.23", | ||
"@orion-js/schema": "^3.0.0-alpha.23", | ||
"body-parser": "1.19.0", | ||
@@ -42,3 +42,3 @@ "express": "4.17.1" | ||
}, | ||
"gitHead": "145e17f5a9d6bbf02f166c5faa416be60752a42f" | ||
"gitHead": "3a2082794e3b1a8748a5aace8d68e5c18a92b707" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19390
441