Created
January 2, 2019 18:42
-
-
Save Seanny123/dc3218495f53ff34cc0c324f9601959f to your computer and use it in GitHub Desktop.
Basic Genie REST-like server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Genie | |
import Genie.Router: route, @params | |
import Base.convert | |
convert(::Type{Int}, s::SubString{String}) = parse(Int, s) | |
route("/sum/:x::Int/:y::Int") do | |
return @params(:x) + @params(:y) | |
end | |
route("/hello") do | |
return "Welcome to Genie!" | |
end | |
route("/") do | |
return "root" | |
end | |
Genie.AppServer.startup(async=false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment