From dce5159d2a7c8d2043a9686cbeca76fec69fac87 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 29 Jun 2021 00:08:09 +0200 Subject: Add static file server Some simple code that allows Cana to serve files from a directory, and not just provide static responses. --- app/Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index 000726d..50ca151 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -4,6 +4,7 @@ module Main where import Cana import Cana.Protocol import Cana.Router +import Cana.Extra defaultResponse :: GeminiResponse defaultResponse = GeminiResponse @@ -14,5 +15,5 @@ defaultResponse = GeminiResponse main :: IO () main = runGeminiServer Nothing defaultGeminiPort "certificate.crt" "private.key" - [ (anyRoute, const $ return defaultResponse) + [ (anyRoute, staticFiles "gmdocs") ] -- cgit v1.2.3