Skip to content

Instantly share code, notes, and snippets.

@ThomasLocke
Created September 27, 2014 15:29
Show Gist options
  • Save ThomasLocke/ec0c23bca4b48718782f to your computer and use it in GitHub Desktop.
Save ThomasLocke/ec0c23bca4b48718782f to your computer and use it in GitHub Desktop.
shelftest.main()
import 'dart:io';
import '../lib/routes.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as io;
import 'package:shelf_exception_response/exception_response.dart';
void main() {
final shelf.Handler handler = const shelf.Pipeline()
.addMiddleware(shelf.logRequests())
.addMiddleware(exceptionResponse())
.addHandler(routes.handler);
io.serve(handler, InternetAddress.LOOPBACK_IP_V4, 8080).then((server) {
print('Listening on port 8080');
}).catchError((error) => print(error));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment