| 17 | } |
| 18 | |
| 19 | export function startStudioServer(options: StartStudioServerOptions): StudioServer { |
| 20 | switch (runtime) { |
| 21 | case 'node': |
| 22 | return startNodeStudioServer(options) |
| 23 | case 'bun': |
| 24 | return startBunStudioServer(options) |
| 25 | case 'deno': |
| 26 | return startDenoStudioServer(options) |
| 27 | default: |
| 28 | throw new Error(`Unsupported runtime for Studio server: "${runtime}"`) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | function startNodeStudioServer({ handler, onListen, port }: StartStudioServerOptions): StudioServer { |
| 33 | const server = createServer(async (nodeRequest, nodeResponse) => { |