Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update next.js demo #362

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions examples/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MilvusClient } from '@zilliz/milvus2-sdk-node';

async function getData() {
async function getData(address: string) {
const milvusClient = new MilvusClient({
address: 'localhost:19530',
address,
});

let res: any = await milvusClient.getMetric({
Expand All @@ -17,7 +17,24 @@ async function getData() {
}

export default async function Home() {
const data = await getData();
const address = `10.102.5.223:19530`;

return <>{JSON.stringify(data)}</>;
const data = await getData(address);

return (
<div className="min-h-screen flex items-center justify-center bg-gray-100">
<div className="max-w-4xl w-full p-6 bg-white rounded-lg shadow-md">
<h1 className="text-3xl font-bold text-center mb-4">
Welcome to Milvus
</h1>
<h2 className="text-xl font-bold text-center mb-4">{address}</h2>

<div className="bg-gray-50 p-4 rounded-lg">
<pre className="whitespace-pre-wrap text-sm text-gray-800">
{JSON.stringify(data, null, 2)}
</pre>
</div>
</div>
</div>
);
}
10 changes: 6 additions & 4 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"lint": "next lint"
},
"dependencies": {
"@zilliz/milvus2-sdk-node": "^2.4.3",
"next": "^14.2.4",
"react": "^18",
"react-dom": "^18"
"@uiw/react-codemirror": "^4.23.3",
"@zilliz/milvus2-sdk-node": "^2.4.9",
"codemirror": "^6.0.1",
"next": "^14.2.13",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
Loading
Loading