MCPcopy
hub / github.com/vercel/next.js / startStaticServer

Function startStaticServer

test/lib/next-test-utils.ts:733–750  ·  view source on GitHub ↗
(
  dir: string,
  notFoundFile?: string,
  fixedPort?: number
)

Source from the content-addressed store, hash-verified

731}
732
733export async function startStaticServer(
734 dir: string,
735 notFoundFile?: string,
736 fixedPort?: number
737) {
738 const app = express()
739 const server = http.createServer(app)
740 app.use(express.static(dir))
741
742 if (notFoundFile) {
743 app.use((req, res) => {
744 createReadStream(notFoundFile).pipe(res)
745 })
746 }
747
748 await startListen(server, fixedPort)
749 return server
750}
751
752export async function startCleanStaticServer(dir: string) {
753 const app = express()

Callers 6

index.test.tsFile · 0.90
devStartAndExportFunction · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
runTestsFunction · 0.90

Calls 5

startListenFunction · 0.85
createServerMethod · 0.80
staticMethod · 0.80
createReadStreamFunction · 0.50
pipeMethod · 0.45

Tested by 1

devStartAndExportFunction · 0.72