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

outdated

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
0
pub points
53%
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

License

unknown (license)

Dependencies

dia

More

Packages that depend on dia_cors