package app.controllers;

import java.util.Collections;
import java.util.List;

import net.javapla.jawn.core.Controller;
import app.db.DbManager;
import app.models.Fortune;

import com.google.inject.Inject;

public class FortunesController extends Controller {

    @Inject
    private DbManager db;
    
    public void index() {
        List<Fortune> fortunes = db.fetchAllFortunes();
        fortunes.add(new Fortune(0, "Additional fortune added at request time."));
        Collections.sort(fortunes, (f1, f2) -> f1.message.compareTo(f2.message));
        view("fortunes", fortunes);
    }
}

@@ -581,16 +581,53 @@
 tunes);%0A
+        render().layout(%22../index%22);%0A
     %7D%0A%7D%0A

Fix the timeout in the fortunes endpoint for jawn (#2663)