A minimal Express-style HTTP server using DiscountKit adapters without React.
- REST API for discount management
- Multi-platform support (Shopify + BigCommerce)
- Capability validation endpoint
- Cross-platform discount sync
From the monorepo root:
pnpm install
pnpm buildThen:
cd examples/node-api-only
pnpm devServer starts on http://localhost:3001.
Create a discount on a specific platform.
curl -X POST http://localhost:3001/discounts \
-H "Content-Type: application/json" \
-d '{
"platform": "shopify",
"incentive": {
"title": "Test 10%",
"value": { "type": "percentage", "percentage": 0.1 },
"code": { "type": "static", "code": "TEST10" }
}
}'Validate an incentive against a platform.
curl -X POST http://localhost:3001/validate \
-H "Content-Type: application/json" \
-d '{
"platform": "bigcommerce",
"incentive": {
"title": "BXGY Test",
"value": { "type": "bxgy", "customerBuys": {...}, "customerGets": {...} }
}
}'Create the same discount across multiple platforms.
curl -X POST http://localhost:3001/sync \
-H "Content-Type: application/json" \
-d '{
"platforms": ["shopify", "bigcommerce"],
"incentive": {
"title": "Cross-Platform 15%",
"value": { "type": "percentage", "percentage": 0.15 },
"code": { "type": "static", "code": "CROSS15" }
}
}'This example demonstrates using DiscountKit adapters in a server-side context without any React dependencies. It uses Node.js built-in http module (no Express) to keep dependencies minimal.