Changeset View
Changeset View
Standalone View
Standalone View
java/server/src/main/java/org/softwareheritage/graph/App.java
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | app.get("/neighbors/:src", ctx -> { | ||||
SwhId src = new SwhId(ctx.pathParam("src")); | SwhId src = new SwhId(ctx.pathParam("src")); | ||||
String direction = ctx.queryParam("direction", "forward"); | String direction = ctx.queryParam("direction", "forward"); | ||||
String edgesFmt = ctx.queryParam("edges", "*"); | String edgesFmt = ctx.queryParam("edges", "*"); | ||||
Endpoint endpoint = new Endpoint(graph, direction, edgesFmt); | Endpoint endpoint = new Endpoint(graph, direction, edgesFmt); | ||||
ctx.json(endpoint.neighbors(src)); | ctx.json(endpoint.neighbors(src)); | ||||
}); | }); | ||||
// TODO: anonymous class to return both nodes/paths? (waiting on node types map merged/refactor) | |||||
/*app.get("/visit/:src", ctx -> { | |||||
SwhId src = new SwhId(ctx.pathParam("src")); | |||||
String direction = ctx.queryParam("direction", "forward"); | |||||
String edgesFmt = ctx.queryParam("edges", "*"); | |||||
Visit visit = new Visit(graph, src, edgesFmt, direction, Visit.OutputFmt.NODES_AND_PATHS); | |||||
ctx.json(visit); | |||||
});*/ | |||||
app.get("/visit/nodes/:src", ctx -> { | app.get("/visit/nodes/:src", ctx -> { | ||||
SwhId src = new SwhId(ctx.pathParam("src")); | SwhId src = new SwhId(ctx.pathParam("src")); | ||||
String direction = ctx.queryParam("direction", "forward"); | String direction = ctx.queryParam("direction", "forward"); | ||||
String edgesFmt = ctx.queryParam("edges", "*"); | String edgesFmt = ctx.queryParam("edges", "*"); | ||||
Endpoint endpoint = new Endpoint(graph, direction, edgesFmt); | Endpoint endpoint = new Endpoint(graph, direction, edgesFmt); | ||||
ctx.json(endpoint.visitNodes(src)); | ctx.json(endpoint.visitNodes(src)); | ||||
}); | }); | ||||
Show All 36 Lines |