refactor(routes): Phase 3.1 - standardize services.js with explicit dependencies
- Replaced god object ctx with explicit dependency injection - Added JSDoc documenting all required dependencies - Updated response calls to use response-helpers (success/error) - Maintained all existing functionality - Self-documenting: you can see exactly what this route needs - Easier testing: mock only what's actually used (14 deps vs 50+ ctx properties)
This commit is contained in:
@@ -1188,7 +1188,21 @@ apiRouter.use(configRoutes(ctx));
|
||||
apiRouter.use('/dns', dnsRoutes(ctx));
|
||||
apiRouter.use('/notifications', notificationRoutes(ctx));
|
||||
apiRouter.use('/containers', containerRoutes(ctx));
|
||||
apiRouter.use(serviceRoutes(ctx));
|
||||
apiRouter.use(serviceRoutes({
|
||||
servicesStateManager: ctx.servicesStateManager,
|
||||
credentialManager: ctx.credentialManager,
|
||||
siteConfig: ctx.siteConfig,
|
||||
buildServiceUrl: ctx.buildServiceUrl,
|
||||
buildDomain: ctx.buildDomain,
|
||||
fetchT: ctx.fetchT,
|
||||
asyncHandler: ctx.asyncHandler,
|
||||
SERVICES_FILE: ctx.SERVICES_FILE,
|
||||
log: ctx.log,
|
||||
safeErrorMessage: ctx.safeErrorMessage,
|
||||
resyncHealthChecker: ctx.resyncHealthChecker,
|
||||
caddy: ctx.caddy,
|
||||
dns: ctx.dns
|
||||
}));
|
||||
apiRouter.use(healthRoutes(ctx));
|
||||
apiRouter.use(monitoringRoutes(ctx));
|
||||
apiRouter.use(updatesRoutes(ctx));
|
||||
|
||||
Reference in New Issue
Block a user