Play Framework - Beginner Tutorial : Make a post request and save the form data in Mongodb

Before the tutorial

You should : - read - Play Documentation : ScalaActions - Play Documentation : ScalaForms - Play Documentation : ScalaJsonAutomated - have basic understanding of scala future transformation (map, flatMap) - have basic understanding of scala implicits - clone play2.5-skeleton-compileDI.

This example uses compile-time dependency injection. You can use run-time DI if you feel confident about it. - download and install mongodb (brew install mongo for mac or check the video) - download and install mongochef

Tutorial

After the tutorial

You should be able to : - create a compile-time DI play project - create a form in a play template - understand that a simple post in play requires two endpoints. - one to serve the form - one to handle the post request - create a model class - map a play Form to a case class - mapping - save a case class in Mongo DB

Play2-reactivemongo documentation

Be careful: we are using play2-reactivemongo plugin and not reactivemongo driver

Bonus

Do you know the difference between Action and Action.async ? Find out how to return different result statuses pages. check