1

yesod 1.4.1.5スタック ツールを使用して、スキャフォールディングされた yesod ( ) アプリケーションを使用しています。新しいルートを機能させることができません。

# config/routes
/static StaticR Static appStatic
/auth   AuthR   Auth   getAuth

/favicon.ico FaviconR GET
/robots.txt RobotsR GET

/trails TrailsR  GET

/ HomeR          GET POST

次に、次のモジュールを定義しました。

-- Handler/Trails.hs
module Handler.Trails where

import Import
--import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
--                              withSmallInput)

getTrailsR :: Handler Html
getTrailsR = defaultLayout $ do
    setTitle "Welcome To Yesod!"
    $(widgetFile "trails")

トレイル テンプレート ファイルを作成しました。

-- templates/trails.hamlet
<h1>All Trails A-Z

<ul>
  <li>Hi

.juliusまたは.luciusファイルを作成しませんでした。それは問題ですか?

そして、モジュールを必ず入れましたApplication.hs

-- Import all relevant handler modules here.
-- Don't forget to add new modules to your cabal file!
import Handler.Common
import Handler.Home
import Handler.Trails

そして、そのモジュールをonh.cabalプロジェクトに登録するようにしました。これが完全なライブラリ スタンザです。

library
    hs-source-dirs: ., app
    exposed-modules: Application
                     Foundation
                     Import
                     Import.NoFoundation
                     Model
                     Settings
                     Settings.StaticFiles
                     Handler.Common
                     Handler.Home
                     Handler.Trails

次に、アプリをそのまま起動しますstack exec -- yesod develが、それでも 404 として返されません。

$ curl -v localhost:3000/trails
* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 3000 failed: Connection refused
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /trails HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:3000
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Transfer-Encoding: chunked
< Date: Mon, 31 Aug 2015 05:00:17 GMT
* Server Warp/3.1.2 is not blacklisted
< Server: Warp/3.1.2

私は何を間違っていますか?ルートが正しく配線され、ビルド システムに接続されていることをデバッグするにはどうすればよいですか?

4

1 に答える 1