aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-19 02:16:45 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-19 02:16:45 +0100
commit13e285955508e601d6a648c25e29632340b4d9b6 (patch)
tree10b60331b967c1e2e267f07b997d259ef3441879
parentf7d823cd3455aa73a17c927382ea3f34f4610c23 (diff)
feat(backend): serve index page from assets directory
-rw-r--r--resources/src/index.html26
-rw-r--r--src/backend/tubo/handler.clj20
2 files changed, 16 insertions, 30 deletions
diff --git a/resources/src/index.html b/resources/src/index.html
index 71d7815..f4e6632 100644
--- a/resources/src/index.html
+++ b/resources/src/index.html
@@ -1,15 +1,15 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="/styles/index.css">
- <title>Tubo</title>
-</head>
-<body>
- <noscript>You need to enable JavaScript to run this app.</noscript>
- <div id="app"></div>
- <script src="/js/main.js"></script>
-</body>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="stylesheet" href="/styles/index.css" />
+ <link href="/icons/tubo.svg" rel="icon" type="image/svg+xml" />
+ <title>Tubo</title>
+ </head>
+ <body>
+ <noscript>You need to enable JavaScript to run this app.</noscript>
+ <div id="app"></div>
+ <script src="/js/main.js" type="text/javascript"></script>
+ </body>
</html>
diff --git a/src/backend/tubo/handler.clj b/src/backend/tubo/handler.clj
index bff4326..8a438b8 100644
--- a/src/backend/tubo/handler.clj
+++ b/src/backend/tubo/handler.clj
@@ -1,27 +1,13 @@
(ns tubo.handler
(:require
[clojure.string :as str]
- [hiccup.page :as hiccup]
- [ring.util.response :refer [response]]
+ [ring.util.response :refer [response resource-response content-type]]
[tubo.api :as api]))
(defn index
[_]
- (response
- (hiccup/html5
- [:head
- [:meta {:charset "UTF-8"}]
- [:meta
- {:name "viewport"
- :content
- "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"}]
- [:title "Tubo"]
- [:link {:rel "icon" :type "image/svg+xml" :href "/icons/tubo.svg"}]
- (hiccup/include-css "/styles/index.css")]
- [:body
- [:div#app]
- (hiccup/include-js "/js/main.js")
- [:script "tubo.core.init();"]])))
+ (-> (resource-response "index.html" {:root "public"})
+ (content-type "text/html")))
(defn search
[{{{:keys [service-id]} :path {:keys [q]} :query} :parameters