dia_cors 0.0.4 dia_cors: ^0.0.4 copied to clipboard
CORS middleware for Dia http server. Add CORS headers to response. Use it with 'dia' and 'dia_router' packages
import 'package:dia/dia.dart' as dia;
import 'package:dia_cors/dia_cors.dart';
void main() {
final app = dia.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'));
}