Created
March 23, 2015 00:36
-
-
Save rleegates/c12951cd7e1a21a8652a to your computer and use it in GitHub Desktop.
A simple Servlet
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
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