You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please update the shelf_router documentation to include an example that uses middleware.
I was unaware that I had to create my Router, set up my routes, and then pass it into a Pipeline. The only shelf_router examples I could find only ever show how to set up the Router and then pass it to the serve function. It took several days before I finally found a StackOverflow question that happened to show how to properly set up the pipeline.
As someone new to shelf and shelf_router, this wasn't immediately obvious.
Something like the following block would have been immensely helpful:
import'package:shelf/shelf.dart';
import'package:shelf/shelf_io.dart'as io;
voidmain() async {
// set up your router and routesfinal router =Router()..get('/', () =>Response.ok('hello world!'));
// set your router as the handler for your pipelinefinal app =constPipeline().addMiddleware(logRequests()).addHandler(router.call);
// pass your pipeline into the serve methodawait io.serve(app.call, '0.0.0.0', 3000);
}
Thank you!
The text was updated successfully, but these errors were encountered:
Please update the
shelf_router
documentation to include an example that uses middleware.I was unaware that I had to create my
Router
, set up my routes, and then pass it into aPipeline
. The onlyshelf_router
examples I could find only ever show how to set up theRouter
and then pass it to theserve
function. It took several days before I finally found a StackOverflow question that happened to show how to properly set up the pipeline.As someone new to
shelf
andshelf_router
, this wasn't immediately obvious.Something like the following block would have been immensely helpful:
Thank you!
The text was updated successfully, but these errors were encountered: