Skip to content

Instantly share code, notes, and snippets.

@solidsnack
Last active December 15, 2015 22:19
Show Gist options
  • Select an option

  • Save solidsnack/5332675 to your computer and use it in GitHub Desktop.

Select an option

Save solidsnack/5332675 to your computer and use it in GitHub Desktop.
Suggestions from scala-user
import org.scalatra._
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.webapp.WebAppContext
object Go {
def main(args: Array[String]) {
val server = new Server(8080)
val context = new WebAppContext()
context.setContextPath("/")
context.addServlet(classOf[Slash], "/*")
server.setHandler(context)
server.start
server.join
}
class Slash extends ScalatraServlet {
get() {
contentType = "text/plain"
"Welcome to /"
}
get("/x") {
contentType = "text/plain"
"Welcome to /x"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment