Menu

Official website

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


03 Oct 2016

min read

Before the tutorial

You should :

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

play.

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

Ressources

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

expand_less