Last active
February 5, 2022 09:30
-
-
Save felixblaschke/f3b5b3d9f11ae85c31f2c4792a381682 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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