Skip to content

Instantly share code, notes, and snippets.

@rleegates
Created March 23, 2015 00:36
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 rleegates/c12951cd7e1a21a8652a to your computer and use it in GitHub Desktop.
Save rleegates/c12951cd7e1a21a8652a to your computer and use it in GitHub Desktop.
A simple Servlet
module WebInterface
using Morsel
app = Morsel.app()
using Debug
import JSON
route(app, GET | POST | PUT, "/") do req, res
if haskey(req.state, :url_params)
return JSON.json(req.state[:url_params])
else
return ""
end
end
get(app, "/about") do req, res
"This app is running on Morsel"
end
start(app, 8000)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment