Skip to content

Instantly share code, notes, and snippets.

@felixblaschke
Last active February 5, 2022 09:30
Show Gist options
  • Save felixblaschke/f3b5b3d9f11ae85c31f2c4792a381682 to your computer and use it in GitHub Desktop.
Save felixblaschke/f3b5b3d9f11ae85c31f2c4792a381682 to your computer and use it in GitHub Desktop.
import 'dart:io';
import 'package:shelf_plus/shelf_plus.dart';
void main() => shelfRun(init); // runs server with hot-reload preconfigured
Handler init() {
var app = Router().plus;
app.get('/', () => 'Hello World!');
// One line file server
app.get('/<fileName>', (request, fileName) => File('public/$fileName'));
return app;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment