Safe Haskell | None |
---|---|
Language | Haskell2010 |
Since the single page application URIs are specified with Servant, we can automate much of the process of serving the application with server-side rendering. This module provides the basic infrastructure for serving rendered HTML using the same code that would be used to render the same route on the client-side, ensuring a consistent rendering, whether a URI is accessed via a client-side popstate event or via the initial page load.
Synopsis
- toFile :: Piece -> ByteString -> File
- defaultSPAServerSettings :: FilePath -> IO (Html m a) -> StaticSettings
- class ServeRouter layout route m a where
- serveDirectoryWithSpa :: StaticSettings -> ServerT (View m a) n
Documentation
toFile :: Piece -> ByteString -> File Source #
Helper to serve a ByteString
as a file from the web application interface.
defaultSPAServerSettings Source #
:: FilePath | Directory to try files |
-> IO (Html m a) | Get the index.html page |
-> StaticSettings |
Serve index.html generated from a Shpadoinkle view using the static backend, otherwise serve out of a directory.
class ServeRouter layout route m a where Source #
Serve the UI by generating a Servant Server from the SPA URIs
Instances
ServeRouter Raw r m a Source # | |
(ServeRouter x r m a, ServeRouter y r m a) => ServeRouter (x :<|> y) r m a Source # | |
ServeRouter (View n b) r m a Source # | |
ServeRouter sub r m a => ServeRouter (QueryParam sym x :> sub) r m a Source # | |
Defined in Shpadoinkle.Router.Server | |
ServeRouter sub r m a => ServeRouter (QueryParams sym x :> sub) r m a Source # | |
Defined in Shpadoinkle.Router.Server | |
ServeRouter sub r m a => ServeRouter (QueryFlag sym :> sub) r m a Source # | |
ServeRouter sub r m a => ServeRouter (Capture sym x :> sub) r m a Source # | |
ServeRouter sub r m a => ServeRouter (path :> sub) r m a Source # | |
serveDirectoryWithSpa :: StaticSettings -> ServerT (View m a) n Source #