feat(example): include protocol in startup log URL for clickable terminal links (#1745)#1746
feat(example): include protocol in startup log URL for clickable terminal links (#1745)#1746ARUNKUMAR069 wants to merge 2 commits intoelysiajs:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 WalkthroughUpdated the example startup log to compute a protocol string ("https" if Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
PR opened: #1746 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
example/lazy-module.ts (1)
16-19: Nit: spurious blank lines and missing trailing/in URL.Lines 16–17 introduce two consecutive blank lines that add noise. The PR description also mentions the URL should end with
/(http://localhost:3000/), but the template string omits it.✨ Proposed cleanup
- - console.log( - `🔥 Elysia is running at ${protocol}://${app.server?.hostname}:${app.server?.port}` + `🔥 Elysia is running at ${protocol}://${app.server?.hostname}:${app.server?.port}/` )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@example/lazy-module.ts` around lines 16 - 19, Remove the two spurious blank lines around the console.log and update the template string in console.log to include a trailing slash; specifically, edit the console.log invocation that prints `🔥 Elysia is running at ${protocol}://${app.server?.hostname}:${app.server?.port}` so there are no extra blank lines and the URL ends with `/` (e.g., append `/` after `${app.server?.port}`).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@example/lazy-module.ts`:
- Line 5: The const protocol is declared before app is initialized, causing a
TDZ crash and incorrect TLS detection; move the protocol calculation (the
expression using app.server?.tls) to after the application is fully started
(after awaiting app.modules / after app.listen(3000) has run) — e.g., remove or
relocate the line "const protocol = app.server?.tls ? 'https' : 'http'" and
re-declare it just before the console.log so that app and app.server are
initialized and the true TLS state is observed.
---
Nitpick comments:
In `@example/lazy-module.ts`:
- Around line 16-19: Remove the two spurious blank lines around the console.log
and update the template string in console.log to include a trailing slash;
specifically, edit the console.log invocation that prints `🔥 Elysia is running
at ${protocol}://${app.server?.hostname}:${app.server?.port}` so there are no
extra blank lines and the URL ends with `/` (e.g., append `/` after
`${app.server?.port}`).
This PR improves developer experience by including the protocol (
http://orhttps://) in the startup log URL shown in example files.Previously, the startup message displayed:
🔥 Elysia is running at localhost:3000
This change updates it to:
🔥 Elysia is running at http://localhost:3000/
Why
Some terminals only create clickable links when the protocol is included in the URL. Adding the protocol:
Implementation
http://.Related Issue
Closes #1745
Testing
Summary by CodeRabbit