repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps): bump poolifier
[poolifier.git]
/
examples
/
typescript
/
http-server-pool
/
express-hybrid
/
src
/
express-worker.ts
diff --git
a/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts
b/examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts
index 8cc041d4ee20c5f8e1fac45c96914019abcc2d9e..7ba9f374f5fa248012fab50afb72e508f8391de4 100644
(file)
--- a/
examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts
+++ b/
examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts
@@
-1,11
+1,13
@@
import type { Server } from 'node:http'
import type { AddressInfo } from 'node:net'
import type { Server } from 'node:http'
import type { AddressInfo } from 'node:net'
+
+import express, { type Express, type Request, type Response } from 'express'
import {
import {
+ availableParallelism,
ClusterWorker,
ClusterWorker,
- DynamicThreadPool,
- availableParallelism
+ DynamicThreadPool
} from 'poolifier'
} from 'poolifier'
-import express, { type Express, type Request, type Response } from 'express'
+
import {
type ClusterWorkerData,
type ClusterWorkerResponse,
import {
type ClusterWorkerData,
type ClusterWorkerResponse,
@@
-68,14
+70,16
@@
ClusterWorkerResponse
.catch(emptyFunction)
})
.catch(emptyFunction)
})
+ let listenerPort: number | undefined
ExpressWorker.server = application.listen(port, () => {
ExpressWorker.server = application.listen(port, () => {
+ listenerPort = (ExpressWorker.server.address() as AddressInfo).port
console.info(
console.info(
- `⚡️[express server]: Express server is started in cluster worker at http://localhost:${
p
ort}/`
+ `⚡️[express server]: Express server is started in cluster worker at http://localhost:${
listenerP
ort}/`
)
})
return {
status: true,
)
})
return {
status: true,
- port:
(ExpressWorker.server.address() as AddressInfo).
port
+ port:
listenerPort ??
port
}
}
}
}