Kind: Function
Source: src/middleware/serve-static/path.ts
Part of: Middleware
defaultJoin does not support Windows paths and always uses / separators.
If you need Windows path support, please use join exported from node:path etc. instead.
defaultJoin combines path segments for the static-file middleware using / separators. It is intended for URL-style or POSIX-style paths and does not support Windows path conventions; use join from node:path when Windows support is needed.
Signature
tsfunction defaultJoin(paths: string[]): string
Parameters
| Name | Type |
|---|---|
paths | string[] |
Returns: string
Diagram
mermaidgraph LR A[Path segments] --> B[defaultJoin] B --> C[Slash-normalized path] C --> D[Static file lookup]
Usage
tsimport { defaultJoin } from './path'
const filePath = defaultJoin('/public/', '/assets', 'app.js')
console.log(filePath)
// /public/assets/app.js
AI Coding Instructions
- Keep path segments in URL or POSIX format when calling
defaultJoin. - Do not use
defaultJoinfor Windows filesystem paths. - Use
joinfromnode:pathwhen the runtime must support platform-specific separators. - Pass the joined result into static-file path resolution rather than manually concatenating segments.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (1)
ServeStaticOptions—src/middleware/serve-static/index.ts:13
Was this page helpful?