MCPcopy
hub / github.com/prisma/prisma / startDenoStudioServer

Function startDenoStudioServer

packages/cli/src/studio-server.ts:132–157  ·  view source on GitHub ↗
({ handler, onListen, port }: StartStudioServerOptions)

Source from the content-addressed store, hash-verified

130}
131
132function startDenoStudioServer({ handler, onListen, port }: StartStudioServerOptions): StudioServer {
133 const abortController = new AbortController()
134 const deno = (
135 globalThis as typeof globalThis & {
136 Deno?: {
137 serve(
138 options: { port: number; signal: AbortSignal },
139 handler: StudioRequestHandler,
140 ): { shutdown?(): Promise<void> }
141 }
142 }
143 ).Deno
144
145 if (!deno) {
146 throw new Error('Deno runtime is not available.')
147 }
148
149 deno.serve({ port, signal: abortController.signal }, handler)
150 onListen()
151
152 return {
153 close() {
154 abortController.abort()
155 },
156 }
157}
158
159function isHeadRequest(method: string | undefined): boolean {
160 return method === 'HEAD'

Callers 1

startStudioServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected