ForgeTotal.js 5
en

Total.js 5

Allow cross-origin requests with CORS

Total.js 5 · total5@0.0.19 securitycorsrouting Executed against Total.js 5

Browsers block requests from other origins unless the server allows them. CORS(origin) sets the allowed origins for the whole app: pass an address, a comma-separated list, or nothing to allow every origin (*). Prefix an address with + to add it to the existing list.

definitions/cors.js
CORS('https://app.example.com');
controllers/api.js
exports.install = function() {
	ROUTE('GET /api/time/', ($) => $.json({ ok: true }));
};