Permalink
Browse files

get the tasks as JSON

  • Loading branch information...
1 parent 5e79cf3 commit d161ce66cdd21172c217e6cec9b4e8ed72c106c8 @jamesward committed Apr 1, 2015
Showing with 6 additions and 0 deletions.
  1. +5 −0 app/controllers/Application.java
  2. +1 −0 conf/routes
@@ -18,4 +18,9 @@ public static Result addTask() {
return redirect(routes.Application.index());
}
+ public static Result getTasks() {
+ java.util.List<models.Task> tasks = new play.db.ebean.Model.Finder(String.class, models.Task.class).all();
+ return ok(play.libs.Json.toJson(tasks));
+ }
+
}
View
@@ -6,6 +6,7 @@
GET / controllers.Application.index()
GET /foo controllers.Application.index()
POST /task controllers.Application.addTask()
+GET /tasks controllers.Application.getTasks()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)

0 comments on commit d161ce6

Please sign in to comment.