Skip to content

Instantly share code, notes, and snippets.

@Seanny123
Created January 2, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seanny123/dc3218495f53ff34cc0c324f9601959f to your computer and use it in GitHub Desktop.
Save Seanny123/dc3218495f53ff34cc0c324f9601959f to your computer and use it in GitHub Desktop.
Basic Genie REST-like server
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