playframework - Play Framework Project recommended structure -


right we're debating on 2 ways structure our project

  1. decompose project modules , each modules contain models, exception, controller needs. user module might contain user model, possible user exception cases user, , rest end point dealing user

  2. follows traditional approach have top level models, services, controllers, exceptions. in services there sub packages , in exceptions.

structure 1:

app/    /servicea        /models           foo.scala        /controllers        /exceptions        servicea.scala    /serviceb        /models           bar.scala        /controllers        /exceptions        serviceb.scala 

structure 2:

app/    /controllers    /models        foo.scala        bar.scala    /exceptions        /servicea        /serviceb    /services        /servicea        /serviceb 

is there recommended project structure features exceptions, services, models?

the recommended "play" way structure code this:

app   └ controllers   └ models   └ views conf   └ application.conf   └ routes modules   └ admin     └ conf/admin.routes     └ app/controllers     └ app/models     └ app/views      project  └ build.properties  └ build.scala  └ plugins.sbt 

see here: http://www.playframework.com/documentation/2.1.1/sbtsubprojects

in above example, there's 1 module called admin, add more in parallel admin.

structure code way allows take advantage of built-in play subproject features. example, change program context admin typing:

project admin


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -