Changeset View
Changeset View
Standalone View
Standalone View
api/server/src/main/java/org/softwareheritage/graph/App.java
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | app.get("/visit/:swh_id", ctx -> { | ||||
} | } | ||||
} | } | ||||
SwhId swhId = new SwhId(ctx.pathParam("swh_id")); | SwhId swhId = new SwhId(ctx.pathParam("swh_id")); | ||||
// By default, traversal is a forward DFS using all edges | // By default, traversal is a forward DFS using all edges | ||||
String traversal = ctx.queryParam("traversal", "dfs"); | String traversal = ctx.queryParam("traversal", "dfs"); | ||||
String direction = ctx.queryParam("direction", "forward"); | String direction = ctx.queryParam("direction", "forward"); | ||||
String edges = ctx.queryParam("edges", "all"); | String edges = ctx.queryParam("edges", "*"); | ||||
ctx.json(new Visit(graph, swhId, edges, traversal, direction)); | ctx.json(new Visit(graph, swhId, edges, traversal, direction)); | ||||
} catch (IllegalArgumentException e) { | } catch (IllegalArgumentException e) { | ||||
ctx.status(400); | ctx.status(400); | ||||
ctx.result(e.getMessage()); | ctx.result(e.getMessage()); | ||||
} | } | ||||
}); | }); | ||||
app.error(404, ctx -> { ctx.result("Not found"); }); | app.error(404, ctx -> { ctx.result("Not found"); }); | ||||
} | } | ||||
} | } |