Use aero for config and make first deployable version
This commit is contained in:
parent
321a4c4f57
commit
663ddfbce2
8 changed files with 28 additions and 10 deletions
|
|
@ -4,3 +4,4 @@ node_modules
|
|||
resources/public/js
|
||||
.git
|
||||
target
|
||||
pom.xml
|
||||
|
|
|
|||
12
README.md
Normal file
12
README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# All my Friends
|
||||
|
||||
This is scratching a weird itch that started when I saw my friends mostly online.
|
||||
|
||||
## Important paths
|
||||
|
||||
* `src/heyarne/all_my_friends/server.clj`: Contains a simple HTTP server that serves static files and has a handler for uploads
|
||||
* `src/heyarne/all_my_friends/client.cljs`: Is the starting point for the client application
|
||||
* `resources/config.edn`: Uses [aero](https://github.com/juxt/aero/tree/1ecae6465405643aaacd54b9b45b4fdb92d1cf7a) for configuration.
|
||||
* `resources/public`: Contains HTML and CSS files. `resources/public/js` is automatically compiled.
|
||||
* `deps.edn`: Client and server dependencies and build configuration
|
||||
* `shadow-cljs.edn`: Client-side build config for [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html)
|
||||
2
deps.edn
2
deps.edn
|
|
@ -1,6 +1,6 @@
|
|||
{:paths ["src" "resources"]
|
||||
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
|
||||
environ {:mvn/version "1.1.0"}
|
||||
aero {:mvn/version "1.1.6"}
|
||||
http-kit {:mvn/version "2.3.0"}
|
||||
compojure {:mvn/version "1.6.1"}
|
||||
ring-logger {:mvn/version "1.0.1"}}
|
||||
|
|
|
|||
1
resources/config.edn
Normal file
1
resources/config.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
{:port #long #or [#env PORT 8081]}
|
||||
|
|
@ -6,4 +6,4 @@
|
|||
{:app {:target :browser
|
||||
:output-dir "resources/public/js"
|
||||
:asset-path "/js"
|
||||
:modules {:main {:entries [heyarne.all-my-friends.core]}}}}}
|
||||
:modules {:main {:entries [heyarne.all-my-friends.client]}}}}}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(ns heyarne.all-my-friends.core
|
||||
(ns heyarne.all-my-friends.client
|
||||
(:require [applied-science.js-interop :as j]
|
||||
[reagent.dom :as dom]
|
||||
[heyarne.all-my-friends.views :as views]))
|
||||
5
src/heyarne/all_my_friends/env.cljc
Normal file
5
src/heyarne/all_my_friends/env.cljc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(ns heyarne.all-my-friends.env
|
||||
[:require [aero.core :refer [read-config]]
|
||||
[clojure.java.io :as io]])
|
||||
|
||||
(def env (read-config (io/resource "config.edn")))
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
[compojure.core :as router]
|
||||
[compojure.route :as route]
|
||||
[clojure.java.io :as io]
|
||||
[environ.core :refer [env]]
|
||||
[ring.logger :as logger])
|
||||
[ring.logger :as logger]
|
||||
[heyarne.all-my-friends.env :refer [env]])
|
||||
(:gen-class))
|
||||
|
||||
(router/defroutes app
|
||||
|
|
@ -26,11 +26,10 @@
|
|||
|
||||
|
||||
(defn -main [& args]
|
||||
(let [port (Integer/parseInt (env :port "8081"))]
|
||||
(println "Starting server on port" port)
|
||||
(reset! server (-> #'app
|
||||
(logger/wrap-with-logger)
|
||||
(http/run-server {:port port})))))
|
||||
(println "Starting server on port" (env :port))
|
||||
(reset! server (-> #'app
|
||||
(logger/wrap-with-logger
|
||||
(http/run-server {:port (env :port)})))))
|
||||
|
||||
#_(-main)
|
||||
#_(stop-server)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue