Get Started with Upstash Vector & Next.js

Get Started with Upstash Vector & Next.js

A simple example to demonstrate Upstash Vector with Next.js.

0
boilerplate.detail.features.liveDemo

boilerplate.detail.metadata.lastUpdated

il y a 2 mois

R

boilerplate.detail.metadata.author

Renaud

boilerplate.detail.metadata.price

boilerplate.detail.metadata.free

文档

Upstash Vector & Next.js Example

In this example, you can find how you can use Upstash Vector with Next.js.

The client is initialized in /src/app/api/route.ts folder like:

import { Index } from \"@upstash/vector\";

const index = new Index({
  url: process.env.UPSTASH_VECTOR_REST_URL,
  token: process.env.UPSTASH_VECTOR_REST_TOKEN,
})

export const GET = async () => {
  // ...
}

Local Development

First, install the dependencies with:

npm install

Then, create a .env.local file and fill the environment variables:

UPSTASH_VECTOR_REST_URL=\"***\"
UPSTASH_VECTOR_REST_TOKEN=\"***\"

Finally, run:

npm run dev

Deployment

You can deploy with:

npm run deploy

Then, set the environment variables in your project, redeploy and start using the app on Vercel! \

boilerplate.detail.sections.discussion

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联系我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联系我们,我们将尽快回复。