Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sczyh30/vertx-web-scala-play-style
A Play-style functional extension for Vert.x Web Scala
https://github.com/sczyh30/vertx-web-scala-play-style
scala vertx
Last synced: 18 days ago
JSON representation
A Play-style functional extension for Vert.x Web Scala
- Host: GitHub
- URL: https://github.com/sczyh30/vertx-web-scala-play-style
- Owner: sczyh30
- License: apache-2.0
- Created: 2017-04-06T10:22:32.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T12:19:03.000Z (almost 8 years ago)
- Last Synced: 2024-11-01T03:42:15.329Z (2 months ago)
- Topics: scala, vertx
- Language: Scala
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vert.x Web Scala Play-style extension
A Play-style functional, asynchronous extension for Vert.x Web Scala.
## Usage
First import the following packages:
```scala
import io.vertx.scala.functional.utils.Implicits._
import io.vertx.scala.functional.web.Results._
import io.vertx.scala.functional.web.Result
import io.vertx.scala.functional.web.Encoders._
```Then you can write your routing handler methods.
In the extension, the methods will return a `Result` object (or `Future[Result]` for asynchronous handlers).
That is, the type of our handler methods will be `RoutingContext => Result`(or `RoutingContext => Future[Result]`)
instead of `RoutingContext => Unit`(i.e. `Handler[RoutingContext]` in original Vert.x Web).The `Result` object is actually a wrapper for HTTP responses. It provides several helper methods (e.g. `withHeader` for putting HTTP header in HTTP response)
and many useful construct functions(in `Results` object).> Documentation Unfinished.