JlSonic/server.jl

24 lines
468 B
Julia

using Mux
using HTTP
using Revise
import Beets
push!(LOAD_PATH, realpath("JlSonic"))
using JlSonic
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