Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: serve web client from athens server #2192

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/custom-actions/clojure-env

- name: Download built app
uses: actions/download-artifact@v2
with:
name: app
path: resources

- name: Compile server code
run: yarn server:compile

Expand Down
3 changes: 2 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:paths ["src/clj" "src/cljs" "src/cljc" "src/js" "src/gen" "test"]
{:paths ["src/clj" "src/cljs" "src/cljc" "src/js" "src/gen" "test" "resources"]

:deps
{org.clojure/clojure #:mvn{:version "1.11.1"}
Expand Down Expand Up @@ -40,6 +40,7 @@
;; web server
http-kit/http-kit #:mvn{:version "2.5.3"}
compojure/compojure #:mvn{:version "1.6.2"}
ring/ring-core #:mvn{:version "1.9.5"}
;; data validation
metosin/malli #:mvn{:version "0.5.1"}
;; networked repl
Expand Down
12 changes: 10 additions & 2 deletions src/clj/athens/self_hosted/components/web.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
[athens.self-hosted.web.presence :as presence]
[com.stuartsierra.component :as component]
[compojure.core :as compojure]
[org.httpkit.server :as http]))
[org.httpkit.server :as http]
[ring.middleware.resource :as ring.resource]
[ring.util.response :as ring.response]))


;; WebSocket handlers
Expand Down Expand Up @@ -118,9 +120,15 @@
:body "ok"}))


(compojure/defroutes web-client
(-> (compojure/GET "/" [] (ring.response/resource-response "public/index.html"))
(ring.resource/wrap-resource "public")))


(defn make-handler
[datascript fluree config]
(compojure/routes health-check-route
(compojure/routes web-client
health-check-route
(make-ws-route datascript fluree config)))


Expand Down