Skip to content

Commit

Permalink
fix: listeningListener not called (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
rphlmr authored Dec 9, 2024
1 parent 92c6ebd commit 7998b7d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
20 changes: 0 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,12 @@
"editor.defaultFormatter": "biomejs.biome",
"json.format.enable": true,
"editor.formatOnSave": true,
"javascript.format.enable": false,
"javascript.suggest.autoImports": true,
"javascript.suggest.paths": true,
"typescript.format.enable": false,
"typescript.suggest.paths": true,
"typescript.suggest.autoImports": true,
"editor.renderWhitespace": "all",
"editor.rulers": [120, 160],
"editor.codeActionsOnSave": {
"source.fixAll": "never",
"source.organizeImports": "never",
"source.organizeImports.biome": "explicit",
"quickfix.biome": "never"
},
"editor.insertSpaces": false,
"editor.detectIndentation": true,
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"files.trimTrailingWhitespaceInRegexAndStrings": true,
"files.trimFinalNewlines": true,
"explorer.fileNesting.patterns": {
"*.ts": "${basename}.*.${extname}",
".env": ".env.*",
"*.tsx": "${basename}.*.${extname},${basename}.*.ts",
"package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml"
},
"eslint.enable": false,
"eslint.format.enable": false,
"prettier.enable": false,
Expand Down
5 changes: 3 additions & 2 deletions examples/node/custom-build/app/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createHonoServer } from "react-router-hono-server/node";
import reactRouterConfig from "../../react-router.config";
import { exampleMiddleware } from "./middleware";

console.log("loading server");

export default await createHonoServer({
buildDirectory: reactRouterConfig.buildDirectory,
configure(server) {
server.use("*", exampleMiddleware());
},
listeningListener(info) {
console.log(`Server is listening on http://localhost:${info.port}`);
},
});
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-hono-server",
"version": "2.2.0",
"version": "2.2.1",
"type": "module",
"description": "The Vite plugin you need to create a Hono server for your React Router app in less than 10 seconds.",
"exports": {
Expand Down
10 changes: 6 additions & 4 deletions src/adapters/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ export async function createHonoServer<E extends Env = BlankEnv>(
export async function createHonoServer<E extends Env = BlankEnv>(options?: HonoServerOptions<E>) {
const mergedOptions: HonoServerOptions<E> = {
...options,
listeningListener: (info) => {
console.log(`🚀 Server started on port ${info.port}`);
console.log(`🌍 http://127.0.0.1:${info.port}`);
},
listeningListener:
options?.listeningListener ||
((info) => {
console.log(`🚀 Server started on port ${info.port}`);
console.log(`🌍 http://127.0.0.1:${info.port}`);
}),
port: options?.port || Number(process.env.PORT) || 3000,
defaultLogger: options?.defaultLogger ?? true,
};
Expand Down

0 comments on commit 7998b7d

Please sign in to comment.