httpServerStart() — vite Function Reference
Architecture documentation for the httpServerStart() function in http.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f["httpServerStart()"] 695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"] de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f -->|defined in| 695bc011_d16d_4322_2fef_1a59a092ee32 5c50110b_5c76_c14f_b1dd_3efd3df7f375["preview()"] 5c50110b_5c76_c14f_b1dd_3efd3df7f375 -->|calls| de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f b0471d7e_bd66_5836_5a82_7b67d010354d["startServer()"] b0471d7e_bd66_5836_5a82_7b67d010354d -->|calls| de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f 985bbb1d_5299_33eb_c131_28499ef4678b["isPortAvailable()"] de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f -->|calls| 985bbb1d_5299_33eb_c131_28499ef4678b a534d144_3a64_04f3_2a9d_7f383d463d6b["tryBindServer()"] de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f -->|calls| a534d144_3a64_04f3_2a9d_7f383d463d6b style de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/http.ts lines 219–252
export async function httpServerStart(
httpServer: HttpServer,
serverOptions: {
port: number
strictPort: boolean | undefined
host: string | undefined
logger: Logger
},
): Promise<number> {
const { port: startPort, strictPort, host, logger } = serverOptions
for (let port = startPort; port <= MAX_PORT; port++) {
// Pre-check port availability on wildcard addresses (0.0.0.0, ::)
// so that we avoid conflicts with other servers listening on all interfaces
if (await isPortAvailable(port)) {
const result = await tryBindServer(httpServer, port, host)
if (result.success) {
return port
}
if (result.error.code !== 'EADDRINUSE') {
throw result.error
}
}
if (strictPort) {
throw new Error(`Port ${port} is already in use`)
}
logger.info(`Port ${port} is in use, trying another one...`)
}
throw new Error(
`No available ports found between ${startPort} and ${MAX_PORT}`,
)
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does httpServerStart() do?
httpServerStart() is a function in the vite codebase, defined in packages/vite/src/node/http.ts.
Where is httpServerStart() defined?
httpServerStart() is defined in packages/vite/src/node/http.ts at line 219.
What does httpServerStart() call?
httpServerStart() calls 2 function(s): isPortAvailable, tryBindServer.
What calls httpServerStart()?
httpServerStart() is called by 2 function(s): preview, startServer.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free