-
Notifications
You must be signed in to change notification settings - Fork 152
use express()
instead of express.Router()
#604
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -63,10 +63,10 @@ describe('auth', () => { | |||||||||||||||||||
it('should contain the default authentication routes', async () => { | ||||||||||||||||||||
const router = auth(defaultConfig); | ||||||||||||||||||||
server = await createServer(router); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/login'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/logout'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('POST', '/callback'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/callback'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('GET', '/login'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('GET', '/logout'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('POST', '/callback'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('GET', '/callback'))); | ||||||||||||||||||||
Comment on lines
+66
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accessing the private
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||
}); | ||||||||||||||||||||
|
||||||||||||||||||||
it('should contain custom authentication routes', async () => { | ||||||||||||||||||||
|
@@ -79,10 +79,14 @@ describe('auth', () => { | |||||||||||||||||||
}, | ||||||||||||||||||||
}); | ||||||||||||||||||||
server = await createServer(router); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/custom-login'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/custom-logout'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('POST', '/custom-callback'))); | ||||||||||||||||||||
assert.ok(router.stack.some(filterRoute('GET', '/custom-callback'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('GET', '/custom-login'))); | ||||||||||||||||||||
assert.ok(router._router.stack.some(filterRoute('GET', '/custom-logout'))); | ||||||||||||||||||||
assert.ok( | ||||||||||||||||||||
router._router.stack.some(filterRoute('POST', '/custom-callback')) | ||||||||||||||||||||
); | ||||||||||||||||||||
assert.ok( | ||||||||||||||||||||
router._router.stack.some(filterRoute('GET', '/custom-callback')) | ||||||||||||||||||||
); | ||||||||||||||||||||
}); | ||||||||||||||||||||
|
||||||||||||||||||||
it('should redirect to the authorize url for /login', async () => { | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
express()
instead ofexpress.Router()
creates a full Express application instance rather than just a router. This is a significant architectural change that may have unintended consequences. An Express app has additional overhead and functionality (like settings, engines, etc.) that may not be needed. Consider if this change could cause conflicts when the returned object is used as middleware in another Express app.Copilot uses AI. Check for mistakes.