ae789318ba
- Teacher registration requires subject selection; account starts pending - Admin approves/rejects via existing admin panel - Teacher panel (Materialien, Ankündigungen, Prüfungen, Noten) visible only to approved teachers - Students see class materials and announcements via sidebar overlays - Teachers can assign grades to students (scoped to own subject) - New tables: teacher_materials, teacher_announcements, teacher_exams, teacher_assigned_grades - subject column added to users; included in JWT and /api/me - requireTeacher middleware fetches fresh status+subject from DB on every request - Login hint: username is the part of the school email before the @
26 lines
842 B
JavaScript
26 lines
842 B
JavaScript
const express = require('express');
|
|
const cookieParser = require('cookie-parser');
|
|
const path = require('path');
|
|
const routes = require('./src/routes');
|
|
const { router: filesRouter } = require('./src/files');
|
|
const teacherRouter = require('./src/teacher');
|
|
|
|
const app = express();
|
|
const PORT = 3010;
|
|
|
|
app.use(express.json());
|
|
app.use(cookieParser());
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
app.use('/api', routes);
|
|
app.use('/api/files', filesRouter);
|
|
app.use('/api/teacher', teacherRouter);
|
|
|
|
const html = f => (req, res) => res.sendFile(path.join(__dirname, 'public', f));
|
|
|
|
app.get('/login', html('login.html'));
|
|
app.get('/admin', html('admin.html'));
|
|
app.get('/datenschutz', html('datenschutz.html'));
|
|
app.get('/{*path}', html('index.html'));
|
|
|
|
app.listen(PORT, '127.0.0.1', () => console.log(`info1 läuft auf :${PORT}`));
|