TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Sinatra clone in Scala

31 pointsby woobyalmost 16 years ago

5 comments

10renalmost 16 years ago
Is the whole thing really just the one file (110 lines)? <a href="http://github.com/alandipert/step/blob/42cee9ecd360205def359ce2719f34120edee499/src/main/scala/Step.scala" rel="nofollow">http://github.com/alandipert/step/blob/42cee9ecd360205def359...</a> I know it describes itself as "tiny", and sinatra is also tiny, but that seems... small. (I don't know anything about Scala - is it especially concise?)<p>I like how the HTML seems to be a first-class datatype in the example (is that a Scala thing? I'd better do some research):<p><pre><code> get("/date/:year/:month/:day") { &#60;ul&#62; &#60;li&#62;Year: {params("year")}&#60;/li&#62; &#60;li&#62;Month: {params("month")}&#60;/li&#62; &#60;li&#62;Day: {params("day")}&#60;/li&#62; &#60;/ul&#62; }</code></pre>
评论 #634611 未加载
评论 #634735 未加载
rmaccloyalmost 16 years ago
Awesome. I actually fired up Sinatra on JRuby for a micro-app that needs to talk to some Java stuff last week. All of the existing stuff in Scala was way too heavy for the purpose. (Clojure/compojure has comparable overhead to Sinatra assuming you're familiar with Clojure, but it was untenable in this particular circumstance.)<p>At least half the magic of Sinatra is that you can write a single Ruby script, exec it and not have to fool around with build/generate/scaffold script or web server configuration to get something useful. It seems like you're pretty close, given that Java has no standard dependency retrieval system.
causticalmost 16 years ago
Amazing conciseness. Don't forget to check out lift web framework <a href="http://liftweb.net/" rel="nofollow">http://liftweb.net/</a>. It's written in Scala too and uses similar techniques.
papafalmost 16 years ago
Very cool. I notice that you're using sbt to build. I'm using maven to build a scala project. I'd be very interested to know how sbt compares to maven if you have experience with both build systems.
评论 #634682 未加载
holaberlinalmost 16 years ago
It looks like there is no separation between view and controller. Mixing HTML into your controller methods seems like a step backwards.
评论 #634937 未加载
评论 #634924 未加载
评论 #635787 未加载