8000 auth: pass a router to setup auth routes instead of app by tahini · Pull Request #1393 · chairemobilite/transition · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

auth: pass a router to setup auth routes instead of app #1393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

tahini
Copy link
Collaborator
@tahini tahini commented May 27, 2025

fixes #1392

Setting the routes on a router gives more flexibility to the caller to add middleware and prefix the paths to the auth routes.

The app is a Router, but the reverse is not true. So we do not need to change the way those routes are set in the Transition app, as the express application in Transition is quite simple.

fixes chairemobilite#1392

Setting the routes on a router gives more flexibility to the caller to
add middleware and prefix the paths to the auth routes.

The app is a `Router`, but the reverse is not true. So we do not need to
change the way those routes are set in the Transition app, as the
express application in Transition is quite simple.
@tahini tahini requested review from kaligrafy and Copilot May 27, 2025 13:20
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the auth routes setup to accept an Express Router instead of the full app, enabling callers to mount or prefix auth routes with custom middleware.

  • Update default export signature from express.Express to express.Router
  • Replace all app.get/app.post calls with router.get/router.post
  • Adjust unit tests to instantiate and mount a Router on the app

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/chaire-lib-backend/src/api/auth.routes.ts Change function signature and route registrations to use Router
packages/chaire-lib-backend/src/api/tests/auth.routes.test.ts Instantiate Router, register auth routes, and mount on app

@tahini
Copy link
Collaborator Author
tahini commented May 30, 2025

@kaligrafy ping on this review

@tahini tahini merged commit bc50cfd into chairemobilite:main Jun 6, 2025
9 checks passed
@tahini tahini deleted the authRouter branch June 6, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auth: set the auth routes on an express router instead of the app
2 participants
0