Commit f87971e
Fix display banner when using node adapter (#245)
* fix(banner): display banner when using node adapter
The `@elysiajs/node` adapter does not pass the `server` object into the `onStart` hook, causing the startup banner to be skipped.
This fix adds a fallback to extract port and hostname from environment variables (`PORT` and `HOST`) and defaults to `3000`/`localhost` if the `server` object is undefined.
Fixes #244 (Follow-up to #231)
Co-authored-by: Noppakorn Kaewsalabnil <PunGrumpy@users.noreply.github.com>
* Add regression test for onStart when server is undefined (#246)
- Extract createOnStartHandler from index.ts for testability
- Add test that simulates Node adapter path (server undefined)
- Verify process.env.HOST and process.env.PORT are used correctly
- Assert startup banner is emitted with expected URL
- Clean up process.env and restore console spies
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Noppakorn Kaewsalabnil <PunGrumpy@users.noreply.github.com>
* fix(logixlysia): specify return type for onStart hook
Updated the onStart hook in the logixlysia function to explicitly define the return type as void, enhancing type safety and clarity in the codebase.
* refactor(logixlysia): remove redundant onStart test and clean up imports
Eliminated the test for the onStart handler when the server is undefined, as it was deemed unnecessary. Cleaned up imports by removing the createOnStartHandler and spyConsole references, streamlining the test file.
* refactor(logixlysia): remove createOnStartHandler function
Eliminated the createOnStartHandler function and its associated type definitions from index.ts to streamline the codebase. This change simplifies the logic for starting the server by directly handling the server context within the logixlysia function.
---------
Co-authored-by: Noppakorn Kaewsalabnil <PunGrumpy@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>1 parent 8bd7d04 commit f87971e
2 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
0 commit comments