Skip to content

Commit

Permalink
Add sample project for play-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vil1 committed Aug 14, 2017
1 parent 522fcd8 commit e3345e1
Show file tree
Hide file tree
Showing 11 changed files with 547 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/play-2.6/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
logs
target
/.idea
/.idea_modules
/.classpath
/.project
/.settings
/RUNNING_PID
8 changes: 8 additions & 0 deletions samples/play-2.6/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This software is licensed under the Apache 2 license, quoted below.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
49 changes: 49 additions & 0 deletions samples/play-2.6/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
This is your new Play application
=================================

This file will be packaged with your application when using `activator dist`.

There are several demonstration files available in this template.

Controllers
===========

- HomeController.scala:

Shows how to handle simple HTTP requests.

- AsyncController.scala:

Shows how to do asynchronous programming when handling a request.

- CountController.scala:

Shows how to inject a component into a controller and use the component when
handling requests.

Components
==========

- Module.scala:

Shows how to use Guice to bind all the components needed by your application.

- Counter.scala:

An example of a component that contains state, in this case a simple counter.

- ApplicationTimer.scala:

An example of a component that starts when the application starts and stops
when the application stops.

Filters
=======

- Filters.scala:

Creates the list of HTTP filters used by your application.

- ExampleFilter.scala

A simple filter that adds a header to every response.
21 changes: 21 additions & 0 deletions samples/play-2.6/app/controllers/ExampleController.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package controllers

import javax.inject._
import play.api.mvc.{Action, AbstractController, ControllerComponents}
import io.kanaka.monadic.dsl._, compat.cats._
import scala.concurrent.ExecutionContext

import scala.concurrent.Future
/**
* @author Valentin Kasas
*/
class ExampleController @Inject() (controllerComponents: ControllerComponents)(implicit ec: ExecutionContext) extends AbstractController(controllerComponents) {

def index = Action.async {
req =>
for {
i <- Future.successful(Right(42)) ?| NotFound
} yield Ok(i.toString)
}

}
19 changes: 19 additions & 0 deletions samples/play-2.6/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name := """play-2.6"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.12.3"

libraryDependencies ++= Seq(
jdbc,
cache,
ws,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.1" % Test,
"io.kanaka" %% "play-monadic-actions" % "2.0.2-SNAPSHOT",
"io.kanaka" %% "play-monadic-actions-cats" % "2.0.2-SNAPSHOT",
"org.typelevel" %% "cats-core" % "1.0.0-MF"

)

Loading

0 comments on commit e3345e1

Please sign in to comment.