Spock-0.6.6.0: Another Haskell web framework for rapid development

Safe HaskellNone
LanguageHaskell98

Web.Spock.Wire

Synopsis

Documentation

data SpockState m Source

Constructors

SpockState 

Fields

ss_treeMap :: !(SpockRouteMap m)
 
ss_middleware :: [Middleware]
 
ss_spockLift :: forall a. m a -> IO a
 

Instances

newtype SpockT m a Source

Constructors

SpockT 

Fields

runSpockT :: RWST BaseRoute () (SpockState m) m a
 

buildApp :: forall m. MonadIO m => (forall a. m a -> IO a) -> SpockT m () -> IO Application Source

defRoute :: MonadIO m => StdMethod -> Text -> ActionT m () -> SpockT m () Source

Define a route matching a provided StdMethod and route

combineRoute :: Text -> Text -> Text Source

Combine two routes, ensuring that the slashes don't get messed up

subcomponent :: MonadIO m => Text -> SpockT m a -> SpockT m a Source

Define a subcomponent

subcomponent "/api" $
   do get "/user" $ text "USER"
      post "/new-user" $ text "OK!"
>>> curl http://localhost:8080/api/user
USER