Play framework

来自开放百科 - 灰狐
跳转到: 导航, 搜索
Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Play framework Thanks, Wikipedia.
Play-framework-90x90.gif

Play 是一个 JavaScala Web框架,很像 Ruby on Rails, 采用 Apache 2 许可协议。

目录

安装

brew install typesafe-activator
activator new my-first-app play-scala
or activator new my-first-app play-java
cd my-first-app
activator
or activator ui

入门

play new helloPlay
选 1 Scala应用 或 2 Java应用
cd helloPlay
play
[help] $ run 8080
或 start 8080 // crtl-d, 后台运行
http://localhost:8080

6 Minute Apps This is an introduction to building Modern Web Apps with Play Framework, Scala, CoffeeScript, and LESS

更多例子:Play for Scala

git clone https://github.com/playforscala/sample-applications // 可使用 play-2.2 的分支

cd ch02-your-first-play-application/first-sample

sbt
[first-sample] $ eclipse
[first-sample] $ run 
http://localhost:9000/

随后,你可以通过 Eclipse 导入刚才的项目,进行代码修改和项目重新构建。

Spring & CF

Play 融合 SpringCloud Foundry

Eclipse

cd helloPlay
play 
[help] $ eclipse with-source=true
...
[info] Sucessfully created Eclipse project files for projects
然后,从 File/Import/General/Existing project 导入刚才的项目

在Eclipse中调试Play2 创建的应用

  • 1. Run->External Tools->External Tools Configuration
  • 2. 新增一个Program,完成后Run 如下图所示:Run
  • 3. 选中项目右键Debug As -> Debug Configuration ,新增一个远程调试配置,如下图所示:Debug

注意端口号是9999,play debug run开启的应用,调试端口默认是9999

  • 4. 打断点,进行调试。如下图所示:Break Point
  • 5. Enjoyed.

更多细节:Setting up your preferred IDE

安全身份验证

BrowserID 的整合

数据库

Modules

现在的 Modules,未来向marketplace方向发展 :)

sbt

REPL

在play项目目录下,执行 activator

$ help
$ console
scala> views.html.index("hello")

HTTP & REST & Akka

用户

课程

图集

链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱