-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontroller.js
34 lines (31 loc) · 1.11 KB
/
controller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const kRCSServiceWorkerVersionID = Date.now().toString();
const OLSKServiceWorker = require('OLSKServiceWorker');
exports.OLSKControllerRoutes = function () {
return {
RCSIdiomaticRoute: {
OLSKRoutePath: '/',
OLSKRouteMethod: 'get',
OLSKRouteFunction (req, res, next) {
return res.OLSKExpressLayoutRender(require('path').join(__dirname, 'view'), {
RCSIdiomaticConvertSourceSampleData: require('fs').readFileSync(require('path').join(__dirname, `sample.${ res.locals.OLSKSharedPageCurrentLanguage }.md`), 'utf8')
});
},
OLSKRouteLanguageCodes: ['en', 'fr', 'es'],
},
RCIServiceWorkerRoute: {
OLSKRoutePath: '/sw.js',
OLSKRouteMethod: 'get',
OLSKRouteFunction(req, res, next) {
return res.type('js').send(OLSKServiceWorker.OLSKServiceWorkerView({
VERSION_ID_TOKEN: kRCSServiceWorkerVersionID,
ORIGIN_PAGE_PATH_TOKEN: res.locals.OLSKCanonical('RCSIdiomaticRoute'),
}));
},
},
};
};
exports.OLSKControllerSharedStaticAssetFolders = function () {
return require('fs').existsSync(require('path').join(__dirname, 'node_modules')) ? [
'_shared/__external',
] : [];
};