This repository was archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Shelf Middlewares
luizmineo edited this page May 29, 2014
·
2 revisions
Since v0.5, Redstone.dart is built around the Shelf framework. That means you can use any Shelf middleware or handler in your app:
main() {
//Middlewares registered with addShelfMiddleware() will be invoked before
//any interceptor or route.
app.addShelfMiddleware(...);
app.addShelfMiddleware(...);
//The handler registered with setShelfHandler() will be invoked when all
//interceptors are completed, and there is no route for the requested URL.
app.setShelfHandler(...);
app.setupConsoleLog();
app.start();
}
For example, you can use shelf_static to serve static files:
import 'package:redstone/server.dart' as app;
import 'package:shelf_static/shelf_static.dart';
main() {
app.setShelfHandler(createStaticHandler("../web",
defaultDocument: "index.html",
serveFilesOutsidePath: true));
app.setupConsoleLog();
app.start();
}
-
Quick Start Guide
-
Reference
-
Serialization
-
Databases
-
MVC
-
Web Sockets