0

我有一个简单的服务器

{-# LANGUAGE OverloadedStrings #-}

import Web.Scotty
import Data.Text
import Data.Monoid (mconcat)

server :: ScottyM ()
server = do
  get "/" $ file "./index.html"

我想index.html在所有路线上服务,例如。get "*" $ file "./index.html",但这不起作用。如何做到这一点?

4

1 回答 1

0

与提供的示例相同: https ://github.com/scotty-web/scotty

{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Data.Monoid (mconcat)

main = scotty 3000 $
    get "/:word" $ do
        file "./index.html"
于 2017-10-20T10:19:45.603 回答