JlSonic/server.jl

29 lines
603 B
Julia

using Mux
using HTTP
using Revise
push!(LOAD_PATH, "/home/nixo/memories/projects/2018-2019/musicjl")
import Beets
Beets.update_albums();
push!(LOAD_PATH, realpath("JlSonic"))
using JlSonic
JlSonic.loadplaylists()
JlSonic.loadusers()
include("router.jl")
include("login.jl")
@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