import play.api.mvc.{Action, BaseController, ControllerComponents}
import javax.inject.{Inject, Singleton}
import scala.concurrent.ExecutionContext
import play.api.libs.jsoniter.Jsoniter
@Singleton
class UserController @Inject()(val controllerComponents: ControllerComponents)
(implicit executionContext: ExecutionContext)
extends BaseController with Jsoniter {
final case class User(id: Int, username: String)
object User {
import com.github.plokhotnyuk.jsoniter_scala.core._
import com.github.plokhotnyuk.jsoniter_scala.macros._
implicit val jsoniterCodec: JsonValueCodec[User] = JsonCodecMaker.make
}
def create(): Action[User] = Action(jsoniter.json[User]) { request =>
Ok
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
License
gcnyin/play-jsoniter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description or website provided.
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published