Skip to content

Commit 703cf1f

Browse files
committed
fix: add 404 error in public router
Signed-off-by: Umberto Sgueglia <[email protected]>
1 parent c746776 commit 703cf1f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

backend/src/api/public/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { Router } from 'express'
22

3+
import { NotFoundError } from '@crowd/common'
4+
35
import { errorHandler } from './middlewares/errorHandler'
46
import { v1Router } from './v1'
57

68
export function publicRouter(): Router {
79
const router = Router()
810

911
router.use('/v1', v1Router())
12+
13+
router.use(() => {
14+
throw new NotFoundError()
15+
})
16+
1017
router.use(errorHandler)
1118

1219
return router

backend/src/api/public/v1/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Router } from 'express'
22

3-
import { NotFoundError } from '@crowd/common'
4-
53
import { AUTH0_CONFIG } from '../../../conf'
64
import { oauth2Middleware } from '../middlewares/oauth2Middleware'
75
import { staticApiKeyMiddleware } from '../middlewares/staticApiKeyMiddleware'
@@ -17,9 +15,5 @@ export function v1Router(): Router {
1715
router.use('/organizations', oauth2Middleware(AUTH0_CONFIG), organizationsRouter())
1816
router.use('/member-organization-affiliations', staticApiKeyMiddleware(), devStatsRouter())
1917

20-
router.use(() => {
21-
throw new NotFoundError()
22-
})
23-
2418
return router
2519
}

0 commit comments

Comments
 (0)