nrepl! documentation!

neo4j-4
Josha von Gizycki 5 years ago
parent 84a8c076a2
commit ddd2c689f6

@ -12,7 +12,7 @@ You'll need:
- JDK >= 8 - JDK >= 8
- Leiningen >= 2.9 - Leiningen >= 2.9
### First time launch with fresh database ### First time launch with fresh a database
- start a neo4j database with `lein neo4j` - start a neo4j database with `lein neo4j`
- start a repl with `lein repl` or similar - start a repl with `lein repl` or similar
@ -28,6 +28,23 @@ You'll need:
- run `wanijo.main/start-server-dev!` - run `wanijo.main/start-server-dev!`
- the application is available on port `8080` - the application is available on port `8080`
### Launch as a standalone
- build the uberjar via `lein uberjar`
- start your neo4j database, preferably **not** via `lein neo4j`
- start the jar file via `java -jar [jar-file]-standalone.jar`
- if this is the first start with a fresh database, connect to the nREPL as described in the chapter "nREPL" and run the commands described in "First time launch with a fresh database"
### nREPL
When started via its `main` method, as is the uberjar case, an nREPL server is started with it. The default port is `7888`, but this can be configured via the `NREPL_PORT` environment variable.
To connect via the command line, use the following command:
```
clj -Sdeps '{:deps {nrepl {:mvn/version "0.7.0"}}}' -m nrepl.cmdline --connect --host host --port port
```
### "Architecture" ### "Architecture"
> Structure your application as it seems to fit your needs. Then call it architecture and pat yourself on the shoulder. You've achieved something! > Structure your application as it seems to fit your needs. Then call it architecture and pat yourself on the shoulder. You've achieved something!

@ -7,6 +7,7 @@
:dependencies [;;clojure core :dependencies [;;clojure core
[org.clojure/clojure "1.10.1"] [org.clojure/clojure "1.10.1"]
[nrepl "0.7.0"]
;; static site ;; static site
[compojure "1.6.1"] [compojure "1.6.1"]

@ -1,6 +1,7 @@
(ns wanijo.main (ns wanijo.main
(:require [ring.adapter.jetty :refer [run-jetty]] (:require [ring.adapter.jetty :refer [run-jetty]]
[wanijo.handler :as wanijo-handler]) [wanijo.handler :as wanijo-handler]
[nrepl.server :as nrepl])
(:gen-class)) (:gen-class))
(defonce server (atom nil)) (defonce server (atom nil))
@ -24,6 +25,13 @@
(.stop @server))) (.stop @server)))
(defn -main [& args] (defn -main [& args]
(start-server! :port (Integer/valueOf (or (System/getenv "port") (let [nrepl-port (Integer/valueOf (or (System/getenv "NREPL_PORT")
"3080")) "7888"))
:join? false)) web-port (Integer/valueOf (or (System/getenv "WEB_PORT")
"3080"))]
(println "starting nrepl on port " nrepl-port)
(nrepl/start-server :port nrepl-port)
(println "starting web server on port " web-port)
(start-server! :port web-port
:join? false)))

Loading…
Cancel
Save