MCPcopy Index your code
hub / github.com/codecombat/codecombat / setupQuickBailToMainHTML

Function setupQuickBailToMainHTML

server_setup.js:251–295  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

249});
250
251var setupQuickBailToMainHTML = function(app) {
252
253 const fast = template => (function(req, res, next) {
254 let features;
255 req.features = (features = {});
256
257 if (config.isProduction || true) {
258 res.header('Cache-Control', 'public, max-age=60');
259 res.header('Expires', 60);
260 } else {
261 res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
262 res.header('Pragma', 'no-cache');
263 res.header('Expires', 0);
264 }
265
266 if (/(cn\.codecombat\.com|koudashijie|aojiarui)/.test(req.get('host'))) {
267 features.china = true;
268 if ((template === 'home.html') && (config.product === 'codecombat')) {
269 template = 'home-cn.html';
270 }
271 }
272
273 if (config.chinaInfra) {
274 features.chinaInfra = true;
275 }
276
277 return renderMain(template, req, res);
278 });
279
280 app.get('/', fast('home.html'));
281 app.get('/home', fast('home.html'));
282 app.get('/play', fast('overworld.html'));
283 app.get('/play/level/:slug', fast('main.html'));
284 app.get('/play/:slug', fast('main.html'));
285 if (config.product === 'codecombat') {
286 app.get('/about', fast('about.html'));
287 if (config.product === 'codecombat') { app.get('/features', fast('premium-features.html')); }
288 app.get('/privacy', fast('privacy.html'));
289 app.get('/legal', fast('legal.html'));
290 }
291 if (config.product === 'ozaria') {
292 app.get('/teachers/classes/:slug', fast('main.html'));
293 return app.get('/teachers/:slug', fast('main.html'));
294 }
295};
296
297/*Miscellaneous configuration functions*/
298

Callers 1

server_setup.jsFile · 0.85

Calls 2

fastFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected