final Sequence sequence = new Sequence();
server.start((new DynamicRoutes() {{
get("/albums").to(new Application() {
public void handle(Request request, Response response) throws Exception {
TextBody body = new TextBody();
for (int id : albums.keySet()) {
Album album = albums.get(id);
body.append(String.format("%d: %s\n", id, album.info()));
}
if (body.text().isEmpty()) {
body.append("Your music library is empty");
}
response.body(body);
}
});