blob: cbb589666e56df1566b0b362814acfc49b621da5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
(ns tau.http
(:require
[org.httpkit.server :refer [run-server]]
[tau.router :as router])
(:import
tau.DownloaderImpl
org.schabi.newpipe.extractor.NewPipe
org.schabi.newpipe.extractor.localization.Localization))
(defonce server (atom nil))
(defn start-server!
([]
(start-server! 3000))
([port]
(NewPipe/init (DownloaderImpl/init) (Localization. "en" "GB"))
(reset! server (run-server #'router/app {:port port}))
(println "Server running in port" port)))
(defn stop-server!
[]
(when @server
(@server :timeout 100)
(reset! server nil)))
|