diff --git a/examples/server-threads/server.ts b/examples/server-threads/server.ts index 27a24af..16978b0 100644 --- a/examples/server-threads/server.ts +++ b/examples/server-threads/server.ts @@ -1,11 +1,12 @@ import { createServer } from 'node:http'; +import { threadId } from 'node:worker_threads'; import { mo } from '../../src/index.ts'; import { listen, type ListenArgs } from '../../src/serve/index.ts'; export const runServer = mo(import.meta, async (...args: ListenArgs): Promise => { const srv = createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end(`handled by worker ${process.pid}\n`); + res.end(`handled by thread ${threadId}\n`); }); await listen(srv, ...args); });