Commit ad0c9b94 authored by Will Billingsley's avatar Will Billingsley
Browse files

Writes CSV of student logins

parent 70c93023
package controllers
import java.lang.ProcessBuilder.Redirect
import javax.inject._
import play.api._
import play.api.mvc._
......@@ -11,6 +13,8 @@ import play.api.mvc._
@Singleton
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
/**
* Create an Action to render an HTML page.
*
......@@ -19,6 +23,27 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
* a path of `/`.
*/
def index() = Action { implicit request: Request[AnyContent] =>
Ok(views.html.index())
Redirect("assets/lavaclient/index.html")
}
val csvFile = "logins.csv"
def csv = Action.async { implicit request: Request[AnyContent] =>
import java.io._
import scala.util.Try
import scala.concurrent.Future
Future.fromTry(Try {
val fw = new FileWriter(csvFile, true)
fw.write(request.body.asText + "\n")
fw.flush()
fw.close()
Ok("")
})
}
}
......@@ -8,6 +8,9 @@
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /lavamaze/assets/*file controllers.Assets.at(path="/public", file)
POST /lavamaze/students controllers.HomeController.csv
POST /students controllers.HomeController.csv
GET / controllers.HomeController.index
GET /lavamaze controllers.HomeController.index
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment