LoginSignup
8
8

More than 5 years have passed since last update.

scalaでRESTサービス実装を学ぶ。

Last updated at Posted at 2015-01-17

他に、playでmbaasというプロジェクトbaasboxがあるが、javaベースで実装されているので、ひとまず除外。

今回の対象は、spray|liftweb。・・・調査&学習コスト云々の話が深刻となりそうだが、即座に動く例題をizmailoff氏(ガチな感じのliftwebとspray界隈のコミッター)が公開してくれているので、メモしておこうと思った。

選択肢① liftweb 

  • liftweb(rest+model)+mongodb

OpenBankProjectが、liftで実装したAPIなどをその名の通り、公開してくれている。

いろいろあるので、マイナーなlift実装を比較的まとまった規模のコードで学ぶのに良い。

選択肢② spray+akka+liftweb

  • spray(rest)+akka+liftweb(model)+mongodb

mongodb動かしておけば、githubのメモとおりで例題が即動く(検証環境Ubuntu14.04系)。

$./Spray_Mongo_REST_service/scripts/requests $ ./createUser.sh
{
  "status":"SUCCESSFUL",
  "value":{
    "email":"alex@example.com",
    "username":"test",
    "fullName":"Aleksey",
    "_id":"54ba87191e621d782791ee03",
    "isActive":true,
    "password":"mypass"
  }
$mongo
> use twitter
switched to db twitter
> show collections
system.indexes
tweet
user
> db.user.find()
{ "_id" : ObjectId("54ba87191e621d782791ee03"), "email" : "alex@example.com", "username" : "test", "fullName" : "Aleksey", "isActive" : true, "password" : "mypass" }

選択肢(番外編) play(PredictionIO)

PredictionIOは、playを部分的に使った機械学習フレームワーク(レコメンド等)。5700位上のstarを集めており、2015年1月現在、github上のscalaプロジェクトの中では、もっともstarが多い。かなり大きめのフレームワークplayであり、REST実装を学ぶ目的には大きすぎそうだが、気になる存在。

PredictionIOを大づかみにするには、以下から入るといいのかも:
Need to build a personalisation engine? Introducing PredictionIO

※注、上の記事と異なり、PredictionIOバージョン0.84以降は、現時点では、hadoop上でなく、spark上で動作する

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8