aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-12 10:22:52 +0000
committerFuwn <[email protected]>2024-06-12 10:22:52 +0000
commit978a22a537e6749e6d2a6aa2d42da28c9a2d48d7 (patch)
treea56ef938f869721e1e5fb43b6d8b12abd2bc15fc /src
parentdocs(readme): development information (diff)
downloadmayu-978a22a537e6749e6d2a6aa2d42da28c9a2d48d7.tar.xz
mayu-978a22a537e6749e6d2a6aa2d42da28c9a2d48d7.zip
feat: simple index page
Diffstat (limited to 'src')
-rw-r--r--src/request.gleam7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/request.gleam b/src/request.gleam
index 5cdc3c4..d9abccf 100644
--- a/src/request.gleam
+++ b/src/request.gleam
@@ -1,6 +1,7 @@
import database
import gleam/json
import gleam/string_builder
+import simplifile
import svg
import wisp
@@ -18,6 +19,12 @@ pub fn handle(request, connection) {
use _ <- middleware(request)
case wisp.path_segments(request) {
+ [] ->
+ case simplifile.read("index.html") {
+ Ok(content) ->
+ wisp.html_response(string_builder.from_string(content), 200)
+ Error(_) -> wisp.not_found()
+ }
["heart-beat"] ->
wisp.html_response(string_builder.from_string("alive"), 200)
["get", "@" <> name] -> {