MERGE: dev ino feat/service-layer
This commit is contained in:
commit
6404335040
220 changed files with 12582 additions and 10400 deletions
23
backend/src/routes/auth.ts
Normal file
23
backend/src/routes/auth.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import express from 'express';
|
||||
import { getFrontendAuthConfig } from '../controllers/auth.js';
|
||||
import { authenticatedOnly, studentsOnly, teachersOnly } from '../middleware/auth/auth.js';
|
||||
const router = express.Router();
|
||||
|
||||
// Returns auth configuration for frontend
|
||||
router.get('/config', (req, res) => {
|
||||
res.json(getFrontendAuthConfig());
|
||||
});
|
||||
|
||||
router.get('/testAuthenticatedOnly', authenticatedOnly, (req, res) => {
|
||||
res.json({ message: 'If you see this, you should be authenticated!' });
|
||||
});
|
||||
|
||||
router.get('/testStudentsOnly', studentsOnly, (req, res) => {
|
||||
res.json({ message: 'If you see this, you should be a student!' });
|
||||
});
|
||||
|
||||
router.get('/testTeachersOnly', teachersOnly, (req, res) => {
|
||||
res.json({ message: 'If you see this, you should be a teacher!' });
|
||||
});
|
||||
|
||||
export default router;
|
|
@ -32,4 +32,16 @@ router.use('/:hruid/submissions', submissionRoutes);
|
|||
|
||||
router.use('/:hruid/:version/questions', questionRoutes)
|
||||
|
||||
// Parameter: hruid of learning object
|
||||
// Query: language, version (optional)
|
||||
// Route to fetch the HTML rendering of one learning object based on its hruid.
|
||||
// Example: http://localhost:3000/learningObject/un_ai7/html
|
||||
router.get('/:hruid/html', getLearningObjectHTML);
|
||||
|
||||
// Parameter: hruid of learning object, name of attachment.
|
||||
// Query: language, version (optional).
|
||||
// Route to get the raw data of the attachment for one learning object based on its hruid.
|
||||
// Example: http://localhost:3000/learningObject/u_test/attachment/testimage.png
|
||||
router.get('/:hruid/html/:attachmentName', getAttachment);
|
||||
|
||||
export default router;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue