From c614bd35ff1c189bf0104e99fc2653698f2933f5 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Wed, 31 May 2017 10:48:09 -0400 Subject: [PATCH] Make app var global and export it Mostly for future use by other projects --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 29ece3f..8a56ded 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,8 @@ const { getGraph, getGraphFromData, resStatus, serializeData } = require('./src/ var handleResource = require('./src/server/middleware/handle-resource.js'); +var app; + var formats = {parsers: {}} formats.parsers['application/ld+json'] = JsonLdParser formats.parsers['text/turtle'] = N3Parser @@ -205,7 +207,8 @@ function init(options){ config = (options && options.config) ? options.config : config(); console.log(config); - var app = createServer(config); + // app is a global...also exported for using mayktso as an expres() + app = createServer(config); app.use(function(req, res, next) { res.header('X-Powered-By', mayktsoURI); @@ -1422,4 +1425,5 @@ parseLinkHeader, parseProfileLinkRelation, getBaseURL, getExternalBaseURL, +app }