private static readonly startFastify = async (
workerData?: ClusterWorkerData
): Promise<ClusterWorkerResponse> => {
- const { port, ...fastifyPoolifierOptions } = workerData as ClusterWorkerData
+ const { port, ...fastifyPoolifierOptions } = workerData!
FastifyWorker.fastify = Fastify({
logger: true
fastifyPoolifierOptions
)
- FastifyWorker.fastify.all('/api/echo', async (request) => {
+ FastifyWorker.fastify.all('/api/echo', async request => {
return (
await FastifyWorker.fastify.execute({ data: request.body }, 'echo')
).data
FastifyWorker.fastify.get<{
Params: { number: number }
- }>('/api/factorial/:number', async (request) => {
+ }>('/api/factorial/:number', async request => {
const { number } = request.params
return (
await FastifyWorker.fastify.execute({ data: { number } }, 'factorial')