Skip to content

Commit f408f61

Browse files
committed
register routers
1 parent ce2c88d commit f408f61

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

app/app.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import adminBro from 'admin-bro';
88
import adminBroExpressjs from 'admin-bro-expressjs';
99
import adminBroMongoose from 'admin-bro-mongoose';
1010

11-
adminBro.registerAdapter(adminBroMongoose);
12-
11+
import { checkAuth } from './utils/auth';
1312
import visitRouter from './resources/visit/visit.router';
13+
import roadmapRouter from './resources/roadmap/roadmap.router';
1414
import subjectRouter from './resources/subject/subject.router';
15+
import linkRouter from './resources/link/link.router';
1516

1617
export const app = express();
1718

@@ -25,11 +26,19 @@ app.use(
2526
})
2627
);
2728

28-
app.use(expressFormidable());
29+
app.use(expressFormidable()); // needed for adminbro
2930

30-
app.use('/', visitRouter);
31+
// public routes
32+
app.use('/visits', visitRouter);
33+
app.use('/roadmaps', roadmapRouter);
3134
app.use('/subjects', subjectRouter);
3235

36+
// protected routes
37+
app.use('/', checkAuth);
38+
app.use('/links', linkRouter);
39+
40+
adminBro.registerAdapter(adminBroMongoose);
41+
3342
export const start = async () => {
3443
try {
3544
const mongooseDb = await mongoose.connect(process.env.DB_URL || '', {

0 commit comments

Comments
 (0)