A two-service example demonstrating how an API gateway can trigger workflow tasks remotely. An Express API service accepts CSV file uploads and dispatches analysis to a separate workflow service using the Render Client SDK.
- Two-service architecture (API service + workflow service)
- Using the Render Client SDK (
Renderclass) to trigger tasks remotely - File upload handling with Express and Multer
- Error handling with
ClientErrorandServerError
User → API Service (Express) → Render API → Workflow Service
├── POST /analyze └── analyzeFile (task)
└── POST /analyze-task/:name
An Express web server that:
- Accepts CSV file uploads via
POST /analyze - Calls
client.workflows.runTask()to trigger analysis on the workflow service - Returns results to the caller
A workflow service that:
- Defines the
analyzeFiletask for CSV analysis - Parses CSV data, computes column statistics, and detects data quality issues
- A Render API key
- Both services deployed on Render
cd workflow-service
npm install
npm run build
npm startcd api-service
cp .env.example .env
# Edit .env: set RENDER_API_KEY and WORKFLOW_SERVICE_SLUG
npm install
npm run build
npm startThe sample_files/ directory contains example CSV files for testing:
sales_data.csv— sales transaction datacustomer_data.csv— customer information data
Deploy both services:
-
Workflow Service — Create a Workflow service
- Build command:
cd workflow-service && npm install && npm run build - Start command:
cd workflow-service && npm start
- Build command:
-
API Service — Create a Web Service
- Build command:
cd api-service && npm install && npm run build - Start command:
cd api-service && npm start - Environment variables:
RENDER_API_KEY— your Render API keyWORKFLOW_SERVICE_SLUG— the slug of the workflow service
- Build command: