🎉 Add initial exporter (nodejs) application.

This commit is contained in:
Andrey Antukh 2020-06-29 16:07:48 +02:00 committed by Hirunatan
parent d521416329
commit c2db6d4f35
10 changed files with 1048 additions and 0 deletions

View file

@ -0,0 +1,36 @@
(ns app.core
(:require
[lambdaisland.glogi :as log]
[lambdaisland.glogi.console :as glogi-console]
[promesa.core :as p]
[app.http :as http]
[app.config]
[app.browser :as bwr]))
(glogi-console/install!)
(enable-console-print!)
(defonce state (atom nil))
(defn start
[& args]
(log/info :msg "initializing")
(p/let [browser (bwr/start!)
server (http/start! {:browser browser})]
(reset! state {:http server
:browser browser})))
(def main start)
(defn stop
[done]
;; an empty line for visual feedback of restart
(js/console.log "")
(log/info :msg "stoping")
(p/do!
(when-let [instance (:browser @state)]
(bwr/stop! instance))
(when-let [instance (:http @state)]
(http/stop! instance))
(done)))