dia_cors 0.1.2 copy "dia_cors: ^0.1.2" to clipboard
dia_cors: ^0.1.2 copied to clipboard

CORS middleware for Dia http server. Add CORS headers to response. Use it with 'dia' and 'dia_router' packages

example/dia_cors_example.dart

import 'package:dia/dia.dart';
import 'package:dia_cors/dia_cors.dart';

void main() {
  final app = App();

  /// Add CORS middleware
  app.use(cors());

  /// final middleware to response
  app.use((ctx, next) async {
    ctx.body = 'success';
  });

  /// Start server listen on localhsot:8080
  app
      .listen('localhost', 8080)
      .then((info) => print('Server started on http://localhost:8080'));
}
2
likes
160
pub points
48%
popularity

Publisher

verified publisherawcoding.com

CORS middleware for Dia http server. Add CORS headers to response. Use it with 'dia' and 'dia_router' packages

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dia

More

Packages that depend on dia_cors