shelf_azure_application_insights 0.0.2 shelf_azure_application_insights: ^0.0.2 copied to clipboard
A Shelf middleware to send request data to Azure Application Insights.
example/shelf_azure_application_insights_example.dart
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_azure_application_insights/shelf_azure_application_insights.dart';
void main() async {
var handler = const Pipeline()
.addMiddleware(azureApplicationInsightsMiddleware(
connectionString: '<APPLICATION_INSIGHTS_CONNECTION_STRING>'))
.addHandler(_echoRequest);
var server = await shelf_io.serve(handler, 'localhost', 8080);
// Enable content compression
server.autoCompress = true;
print('Serving at http://${server.address.host}:${server.port}');
}
Response _echoRequest(Request request) =>
Response.ok('Request for "${request.url}"');