Skip to content

Commit cde98e4

Browse files
committed
fix: prepend
1 parent e4440c5 commit cde98e4

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

packages/cli/src/start.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function runFastify(opts: Args) {
121121
});
122122

123123
const routes: RouteOptions[] = [];
124-
124+
fastifyInstance.decorate('$addedRoutes', routes);
125125
fastifyInstance.addHook('onRoute', routeOptions => {
126126
routes.push(routeOptions);
127127
});
@@ -192,19 +192,12 @@ async function runFastify(opts: Args) {
192192
address = await fastifyInstance.listen(opts.port);
193193
}
194194

195-
const showAddress = address === `0.0.0.0:${opts.port}` ? `${getOuterIP()}:${opts.port}` : address;
196-
195+
const showAddress = address.replace('0.0.0.0', getOuterIP());
196+
console.log(`Server listening on ${showAddress}.`);
197197
for (const route of routes) {
198198
console.log('——', `${showAddress}${route.url} (${route.method})`);
199199
}
200200

201-
console.log(`Server listening on ${address}.`);
202-
for (const route of routes) {
203-
console.log('——', `${address}${route.url} (${route.method})`);
204-
}
205-
206-
fastifyInstance.decorate('$addedRoutes', routes);
207-
208201
// for pm2 graceful start
209202
if (process.send) {
210203
process.send('ready');

0 commit comments

Comments
 (0)