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 ac2e34d43bfc9ab2f97f51c4a874f2dee782495c..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,15
+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(
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- `⚡️[express server]: Express server is started in cluster worker at http://localhost:${port}/`
+ `⚡️[express server]: Express server is started in cluster worker at http://localhost:${listenerPort}/`
)
})
return {
status: true,
)
})
return {
status: true,
- port:
(ExpressWorker.server.address() as AddressInfo)?.p
ort ?? port
+ port:
listenerP
ort ?? port
}
}
}
}