- Install docker and docker-compose.
- Run
docker-compose up -d
in root directory to launch an instance of PostgreSQL. - Run
sbt db_migrate
to set up schema in PostgreSQL. - (Optional) Run
sbt populate
to populate database in development environment with fixtures. - Run
sbt run
to start thePlay
application.
- Java8
- Play Framework
- Silhouette
- PostgreSQL
- Flyway
- Quill
- Enumeratum
- Circe
- Cats
- Shapeless
- PureConfig
val pagedQuery = quote { (offset: Int,limit: Int) =>
query[Record].drop(offset).take(limit)
}
db.run(pagedQuery)(offset, limit)
Another possibility using lift and implicit quotation:
def pagedQuery(offset: Int,limit: Int) =
db.run(query[Record].drop(lift(offset)).take(lift(limit)))
Also, you should avoid explicit typing your quotation with : Quoted[...]
because it forces the quotation to be dynamic.
Silhouette provides authentication for the application.
By default Silhouette provides default error handlers via Guice dependency injection. To disable the default error
handler, edit application.conf
with the following content
play.modules.disabled += "com.mohiva.play.silhouette.api.actions.SecuredErrorHandlerModule"
Please refer to the list of error handlers section for an overview of all available error handlers and their modules.
Once the default handler module is disabled, you can bind your own implementation.
Global custom error handlers, CustomSecuredErrorHandler
and CustomUnsecuredErrorHandler
, redirect unauthenticated
or unauthorized accesses to the appropriate landing pages.
Silhouette provides a way do add additional authorization logic to secured endpoints. This is done by implementing an
Authorization
object that is passed to all SecuredRequestHandler
and SecuredAction
as a parameter.
utility.authentication.AllowProvider
checks whether a user logged in using a specific login provider. Could be useful for
only exposing contents to specific login method.
Silhouette provides several events and event handling based on Akka's Event Bus. Silhouette itself doesn't listen for events. It is up to developers to decide if an event is useful or not.
Run docker-compose up -d
to launch a PostgreSQL instance for development. By default the database can be connected to
at localhost:27001
.
When the Play
application is launched, database migration is checked. If migration is not up to the latest version,
an error message is displayed on the web page. Click on the Apply this script
button to perform migration.
Alternatively, a manual migration can be performed via sbt. sbt db_migrate
.
Run sbt populate
to populate database in development environment with fixtures.
- Integrate with sbt-docker perhaps??
Set up Play to add hyperlinks to an error page. This will link to runtime exceptions thrown when Play is running in development mode.
Coursier Scala artifact fetching
Coursier is a dependency resolver / fetcher for Maven / Ivy. It can download artifacts in parallel.
A Scala formatter configuration file .scalafmt.conf
is included in the project. Only git included files are formatted.
The sbt plugin, neo-sbt-scalafmt is used to integrate formatter
with sbt. For compatibility with sbt 0.13
, a workaround is used in build.sbt
.
To format source code manually, run sbt scalafmt
to format source code.
At compile time, WartRemover
- Update cats to 1.0.0 when released.
- Update circe to 1.0.0 when its dependency on cats is updated.
- Update slick-pg's when circe is updated.
- Dev, test, prod environment.
- Test code.
- Hikari config.
- Figure out a way to no longer require user to create
Summary.scala
file manually after cloning new project.