Skip to content

Commit 55e2aa4

Browse files
Update default host configuration to allow external connections
1 parent 0ceb425 commit 55e2aa4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/bin/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535

3636
// Default server configuration
3737
const DEFAULT_PORT = 3000;
38-
const DEFAULT_HOST = 'localhost';
38+
const DEFAULT_HOST = '0.0.0.0'; // Changed from 'localhost' to '0.0.0.0' to allow external connections
3939

4040
/**
4141
* Parse command line arguments into a structured object

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function create(options: Partial<ServerOptions> = {}): JsonServer {
6161
// Apply default options
6262
const serverOptions: ServerOptions = {
6363
port: options.port || 3000,
64-
host: options.host || 'localhost',
64+
host: options.host || '0.0.0.0', // Changed from 'localhost' to '0.0.0.0' to allow external connections
6565
cors: options.cors !== undefined ? options.cors : true,
6666
static: options.static || [],
6767
middlewares: options.middlewares || [],

src/utils/cli-styles.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ export function createServerBanner(
143143
port: number,
144144
options: Record<string, any> = {}
145145
): string {
146+
// Create endpoints - keeping it simple regardless of host binding
146147
const endpoints = [
147-
`${styles.url(`http://${host}:${port}`)} - API Root`,
148-
`${styles.url(`http://${host}:${port}/db`)} - Full Database`,
148+
`${styles.url(`http://localhost:${port}`)} - API Root`,
149+
`${styles.url(`http://localhost:${port}/db`)} - Full Database`,
149150
];
150151

151152
const settings = Object.entries(options).map(

0 commit comments

Comments
 (0)