aim_server_cors 0.0.1 copy "aim_server_cors: ^0.0.1" to clipboard
aim_server_cors: ^0.0.1 copied to clipboard

CORS middleware for the aim_server framework.

0.0.1 #

Initial release - CORS middleware extracted from aim_server

Features #

  • Origin validation: Flexible origin control with string, list, or custom function
  • Method restrictions: Specify allowed HTTP methods
  • Header control: Control request and response headers
  • Credentials support: Support for credentials (cookies, authorization headers)
  • Preflight requests: Automatic handling of OPTIONS requests
  • Cache control: Configure cache duration for preflight responses

Examples #

import 'package:aim_server/aim_server.dart';
import 'package:aim_server_cors/aim_server_cors.dart';

final app = Aim();

// Allow all origins (default)
app.use(cors());

// Allow specific origin
app.use(cors(CorsOptions(
  origin: 'https://example.com',
  credentials: true,
)));

// Allow multiple origins
app.use(cors(CorsOptions(
  origin: ['https://example.com', 'https://app.example.com'],
)));

// Custom origin validation
app.use(cors(CorsOptions(
  origin: (String origin) => origin.endsWith('.example.com'),
)));
1
likes
140
points
70
downloads

Publisher

verified publisheraim-dart.dev

Weekly Downloads

CORS middleware for the aim_server framework.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

aim_server

More

Packages that depend on aim_server_cors