使用“ approot”

时间:2019-05-14 19:01:51

标签: haskell yesod

如果我像下面这样设置approot

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where

import Yesod.Core

data Yello = Yello

mkYesod "Yello" [parseRoutes|
/home1 Home1R GET
/home2 Home2R GET
|]

instance Yesod Yello where
    approot = ApprootStatic "http://localhost:3000/v1"

getHome1R :: Handler Html
getHome1R = defaultLayout [whamlet|Homepage 01|]

getHome2R :: Handler Html
getHome2R = defaultLayout [whamlet|<a href=@{Home1R}>Homepage 02|]

main :: IO ()
main = warp 3000 Yello

然后将@{Home1R}渲染到http://localhost:3000/v1/home1 ,但是这个基于Yesod的小型Web应用程序只能在http://localhost:3000上访问(没有{{1} }。

  1. /v1的目的是什么?
  2. 在哪里设置/添加approot

0 个答案:

没有答案