Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolve.app.use(async (req, res) => {
const currentResolve = Object.create(resolve)
try {
await initResolve(currentResolve)
const getCustomParameters = async () => ({ resolve: currentResolve })
const executor = wrapApiHandler(mainHandler, getCustomParameters)
await executor(req, res)
} finally {
await disposeResolve(currentResolve)
}
})
}
}
resolve.getSubscribeAdapterOptions = getSubscribeAdapterOptions.bind(
null,
resolve
)
await initEventStore(assemblies, resolve)
await initExpress(resolve)
await initSubscribeAdapter(resolve)
await initHMR(resolve)
await initDomain(assemblies, resolve)
await initEventLoop(resolve)
const getCustomParameters = async () => ({ resolve })
const executor = wrapApiHandler(mainHandler, getCustomParameters)
resolve.app.use(
getRootBasedUrl(resolve.rootPath, `/${resolve.staticPath}`),
express.static(path.join(process.cwd(), resolve.distDir, './client'))
)
resolve.app.use(executor)
await sagaRunnerExpress(resolve, assemblies.sagas)
await startExpressServer(resolve)
resolveLog('debug', 'Local entry point cold start success', resolve)
return emptyWorker
} catch (error) {
resolveLog('error', 'Local entry point cold start failure', error)
const registerApiHandlers = () => {
for (const { path, method, controller } of apiHandlers) {
const handlerPath = getRootBasedUrl(rootPath, `/api/${path}`)
const executor = wrapApiHandler(controller, getCustomParameters)
app[method.toLowerCase()](handlerPath, executor)
}
}