diff options
Diffstat (limited to 'src/mayu.gleam')
| -rw-r--r-- | src/mayu.gleam | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mayu.gleam b/src/mayu.gleam index 2c3d78e..b204dc0 100644 --- a/src/mayu.gleam +++ b/src/mayu.gleam @@ -12,6 +12,14 @@ pub fn main() { let _ = simplifile.create_directory("./data") let image_cache = cache.load_themes() + let index_html = case simplifile.read("index.html") { + Ok(content) -> content + Error(_) -> { + wisp.log_error("Failed to read index.html") + + "" + } + } use connection <- sqlight.with_connection("./data/count.db") @@ -20,7 +28,9 @@ pub fn main() { let secret_key_base = wisp.random_string(64) let assert Ok(_) = wisp.mist_handler( - fn(request) { request.handle(request, connection, image_cache) }, + fn(request) { + request.handle(request, connection, image_cache, index_html) + }, secret_key_base, ) |> mist.new |