How to serve both dynamic and static pages with Dart and shelf?

后端 未结 3 1029
感情败类
感情败类 2021-02-06 03:36

Using shelf_static to serve static web pages through Dart is no problem:

var staticHandler = createStatic         


        
3条回答
  •  花落未央
    2021-02-06 03:52

    A fallbackHandler can be specified for the Router. It appears that using the static handler here solves the problem.

    Router routes = new Router(fallbackHandler: staticHandler)
      ..get('/item/{itemid}', handler.doItem);
    

提交回复
热议问题