import { HttpSecurityPlugin, corsMiddleware } from '@setu-ts/http-security-plugin';app.register(HttpSecurityPlugin({ cors: { origin: 'https://example.com', credentials: true }, csrf: { trustedOrigins: ['https://example.com'] },}));// Per-route use of standalone factories:app.router.get('/api', { middleware: [corsMiddleware({ origin: 'https://other.com' })], handler: (ctx) => ctx.response.json({ ok: true }),}); Copy
import { HttpSecurityPlugin, corsMiddleware } from '@setu-ts/http-security-plugin';app.register(HttpSecurityPlugin({ cors: { origin: 'https://example.com', credentials: true }, csrf: { trustedOrigins: ['https://example.com'] },}));// Per-route use of standalone factories:app.router.get('/api', { middleware: [corsMiddleware({ origin: 'https://other.com' })], handler: (ctx) => ctx.response.json({ ok: true }),});
Example