// Scoped middleware - creates a new DI scope for each request
export function scopedMiddleware(container) {
  return (req, res, next) => {
    // Create request-scoped container
    req.scope = container.createScope();
    
    // Clean up scope after response
    res.on('finish', () => {
      req.scope.dispose();
    });
    
    next();
  };
}
