feat(geom9 ch3 wave2 + final): §12 «Герон» + Финал Главы 3
This commit is contained in:
@@ -51,6 +51,7 @@ const collectionRoutes = require('./routes/collection');
|
||||
const redBookRoutes = require('./routes/red-book');
|
||||
const parentRoutes = require('./routes/parent');
|
||||
const exam9Routes = require('./routes/exam9');
|
||||
const examPrepRoutes = require('./routes/exam-prep');
|
||||
const textbookRoutes = require('./routes/textbooks');
|
||||
const teacherStudentsRoutes = require('./routes/teacherStudents');
|
||||
|
||||
@@ -171,6 +172,7 @@ app.use('/api/red-book', requireFeature('red_book'), redBookRoutes);
|
||||
app.use('/api/biochem', requireFeature('biochem'), require('./routes/biochem'));
|
||||
app.use('/api/parent', parentRoutes);
|
||||
app.use('/api/exam9', exam9Routes);
|
||||
app.use('/api/exam-prep', examPrepRoutes);
|
||||
app.use('/api/textbooks', textbookRoutes);
|
||||
app.use('/api/teacher-students', teacherStudentsRoutes);
|
||||
|
||||
@@ -340,6 +342,34 @@ app.get('/textbooks', (_req, res) => {
|
||||
res.sendFile(path.join(frontendDir, 'textbooks.html'));
|
||||
});
|
||||
|
||||
// ── Exam preparation module: /exam-prep/:examKey/{,variants,practice,topics,mock}[/...]
|
||||
// All sub-pages share the same examKey segment; sub-view is the second segment.
|
||||
// The HTML file is chosen by the sub-view; examKey is parsed client-side from URL.
|
||||
function sendExamPrep(res, file) {
|
||||
if (!isProd) res.setHeader('Cache-Control', 'no-store');
|
||||
res.sendFile(path.join(frontendDir, file));
|
||||
}
|
||||
const EXAM_PREP_VIEWS = {
|
||||
variants: 'exam-prep-variants.html',
|
||||
practice: 'exam-prep-practice.html',
|
||||
topics: 'exam-prep-topics.html',
|
||||
mock: 'exam-prep-mock.html',
|
||||
};
|
||||
// /exam-prep → redirect to default track (math9 for now)
|
||||
app.get('/exam-prep', (_req, res) => res.redirect(302, '/exam-prep/math9'));
|
||||
// /exam-prep/:examKey → dashboard
|
||||
app.get('/exam-prep/:examKey', (_req, res) => sendExamPrep(res, 'exam-prep.html'));
|
||||
// /exam-prep/:examKey/:view → corresponding sub-page (sub-view + optional trailing segments)
|
||||
app.get(['/exam-prep/:examKey/:view', '/exam-prep/:examKey/:view/*'], (req, res, next) => {
|
||||
const file = EXAM_PREP_VIEWS[req.params.view];
|
||||
if (!file) return next();
|
||||
sendExamPrep(res, file);
|
||||
});
|
||||
|
||||
// NOTE: /exam9 remains live (served by static middleware as exam9.html) until F2
|
||||
// ports the variant browser into /exam-prep/:examKey/variants. The 301 redirect
|
||||
// will be added at that point.
|
||||
|
||||
// Serve HTML files without extension (/dashboard → dashboard.html)
|
||||
// In dev: disable cache so edits are always picked up immediately
|
||||
const htmlCacheOpts = isProd ? { extensions: ['html'] } : {
|
||||
|
||||
Reference in New Issue
Block a user