Skip to content

Commit 83f9167

Browse files
authored
Merge pull request #232 from FalkorDB/add-tip
Fix #218 add tip
2 parents 9e01868 + 98c709e commit 83f9167

File tree

10 files changed

+405
-828
lines changed

10 files changed

+405
-828
lines changed

app/api/repo/[graph]/[node]/route.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
import { NextRequest, NextResponse } from "next/server";
22

3-
export async function GET(request: NextRequest, { params }: { params: { graph: string, node: string } }) {
4-
5-
const nodeId = parseInt(params.node);
6-
const graphId = params.graph;
7-
try {
8-
9-
const result = await fetch(`${process.env.BACKEND_URL}/get_neighbors?repo=${graphId}&node_id=${nodeId}`, {
10-
method: 'GET',
11-
headers: {
12-
"Authorization": process.env.SECRET_TOKEN!,
13-
}
14-
})
15-
16-
const json = await result.json()
17-
18-
return NextResponse.json({ result: json }, { status: 200 })
19-
} catch (err) {
20-
return NextResponse.json({ massage: (err as Error).message }, { status: 400 })
21-
}
22-
}
23-
243
export async function POST(request: NextRequest, { params }: { params: { graph: string, node: string } }) {
254

265
const nodeId = params.node;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { NextRequest, NextResponse } from "next/server";
2+
3+
export async function POST(request: NextRequest, { params }: { params: { graph: string } }) {
4+
5+
const { nodeIds } = await request.json();
6+
const graphId = params.graph;
7+
try {
8+
9+
const result = await fetch(`${process.env.BACKEND_URL}/get_neighbors`, {
10+
method: 'POST',
11+
body: JSON.stringify({ node_ids: nodeIds, repo: graphId }),
12+
headers: {
13+
"Content-Type": 'application/json',
14+
"Authorization": process.env.SECRET_TOKEN!,
15+
}
16+
})
17+
18+
const json = await result.json()
19+
20+
return NextResponse.json({ result: json }, { status: 200 })
21+
} catch (err) {
22+
return NextResponse.json({ massage: (err as Error).message }, { status: 400 })
23+
}
24+
}

0 commit comments

Comments
 (0)