我正在尝试创建一个服务器,该服务器根据用户之前是否访问过它,从路由返回两个不同的值。我有以下代码:
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Web.Scotty
main = do
putStrLn "Starting Server..."
scotty 3000 $ do
get "/" $ do
-- if first time
text "hello!"
-- if second time
text "hello, again!"
我有两个问题: 1. 如何检查用户之前是否请求过路由?2. 我可以在哪里以及如何持久化应用程序状态?