map routers gemaakt met router files in, backend/src/app.ts bevat verwijzingen naar deze files met app.use
This commit is contained in:
parent
c07bb959cf
commit
f45a9aa5a5
9 changed files with 112 additions and 0 deletions
|
@ -1,9 +1,18 @@
|
|||
import express, { Express, Response } from 'express';
|
||||
import initORM from './orm.js';
|
||||
|
||||
import studentRouter from './routes/student';
|
||||
import groupRouter from './routes/group';
|
||||
import assignmentRouter from './routes/assignment';
|
||||
import submissionRouter from './routes/submission';
|
||||
import classRouter from './routes/class';
|
||||
import questionRouter from './routes/question';
|
||||
import loginRouter from './routes/login';
|
||||
|
||||
const app: Express = express();
|
||||
const port: string | number = process.env.PORT || 3000;
|
||||
|
||||
|
||||
// TODO Replace with Express routes
|
||||
app.get('/', (_, res: Response) => {
|
||||
res.json({
|
||||
|
@ -11,6 +20,15 @@ app.get('/', (_, res: Response) => {
|
|||
});
|
||||
});
|
||||
|
||||
app.use('/student', studentRouter);
|
||||
app.use('/group', groupRouter);
|
||||
app.use('/assignment', assignmentRouter);
|
||||
app.use('/submission', submissionRouter);
|
||||
app.use('/class', classRouter);
|
||||
app.use('/question', questionRouter);
|
||||
app.use('/login', loginRouter);
|
||||
|
||||
|
||||
async function startServer() {
|
||||
await initORM();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue