scala webアプリ 実践1-準備
scala webアプリと言っても、広いので、
今回は「play」というフレームワークを使ってやってみたいと思います。
実行環境
対象バージョン:play-2.1.1
OS:mac lion
java:1.7
インストール
公式から、zipをダウンロードして解凍
play へ環境パスを通す
export PATH=$PATH:/Users/hoge_one/Documents/plat/play-2.1.1
mac 系は 「chmod a+x play 」とする必要あり
起動確認
play help
新規アプリ作成
play new myFirstApp What is the application name? [myFirstApp] > Which template do you want to use for this new application? 1 - Create a simple Scala application 2 - Create a simple Java application > 1 OK, application myFirstApp is created. Have fun!
こんな感じで対話形式で作ってくれる。rubyぽい
起動
cd myFirstApp/ bash-4.2$ ls README app conf project public test bash-4.2$ play Getting org.scala-sbt sbt 0.12.2 ... :: retrieving :: org.scala-sbt#boot-app confs: [default] 40 artifacts copied, 0 already retrieved (8381kB/466ms) [info] Loading project definition from /Users/hoge_one/Documents/plat/player/myFirstApp/project [info] Set current project to myFirstApp (in build file:/Users/hoge_one/Documents/plat/player/myFirstApp/) _ _ _ __ | | __ _ _ _| | | '_ \| |/ _' | || |_| | __/|_|\____|\__ (_) |_| |__/ play! 2.1.1 (using Java 1.7.0_21 and Scala 2.10.0), http://www.playframework.org > Type "help play" or "license" for more information. > Type "exit" or use Ctrl+D to leave this console.