return "Shows latest shouts";
}
public Object endpoint(String name, Params params) throws Exception {
if(params._contains("create")) {
Shout s = new Shout(params.get("author"),params.get("text"));
s.save();
return true;
} else {
Feed out = new Feed();
List<Shout> shouts = Shout.find("order by posted desc").fetch(5);
long limit = 1000 * 60 * 60 * 24 * 5; // 5 days in ms
for(Shout s : shouts) {
if( new Date().getTime() - s.posted.getTime() > limit)
s.delete();
else
out.add(s.author, s.body, "");
}
return out;