JlSonic/server.jl

29 lines
595 B
Julia
Raw Normal View History

2019-05-17 20:22:01 +02:00
using Mux
using HTTP
using Revise
2019-05-19 18:28:43 +02:00
push!(LOAD_PATH, "/home/nixo/memories/projects/2018-2019/musicjl")
2019-05-17 20:22:01 +02:00
import Beets
2019-05-19 18:28:43 +02:00
Beets.update_albums();
2019-05-17 20:22:01 +02:00
push!(LOAD_PATH, realpath("JlSonic"))
using JlSonic
2019-05-19 22:24:18 +02:00
JlSonic.loadplaylists()
2019-05-19 18:28:43 +02:00
2019-05-17 20:22:01 +02:00
include("router.jl")
include("login.jl")
2019-05-19 22:24:18 +02:00
loadusers()
2019-05-17 20:22:01 +02:00
@app sonic = (
Mux.defaults,
restp("ping", _ -> ping()),
restp("getLicense", _ -> getLicense()),
mux(sonic_login,
branch(req -> req[:login][:login],
mux(dispatch, Mux.notfound())),
respond(auth_failed())),
)
if !isdefined(Main, :started)
serve(sonic)
started = true
end