Get Started with Upstash QStash & Next.js

Get Started with Upstash QStash & Next.js

A simple example to demonstrate Upstash QStash with Next.js. We will make a publish request through QStash and observe what's delivered.

0
boilerplate.detail.features.liveDemo

boilerplate.detail.metadata.lastUpdated

il y a 4 mois

R

boilerplate.detail.metadata.author

Renaud

boilerplate.detail.metadata.price

boilerplate.detail.metadata.free

文档

QStash With Next.js

This project is a simple example of how to use QStash with Next.js.

Routes in the project:

  • /api/edge (pages router)

  • /api/receiver (pages router)

  • /api/serverless (pages router)

  • /edge (app router)

  • /serverless (app router)

  • '/publish' (app router)

On the landing page of the project, you will find an introduction to QStash. You can click a button to call the /publish endpoint and observe the requests delivered by QStash.

Local Development

1. Install dependencies

npm install

2. Set environment variables

Create a .env.local file in the root of the project and add the following environment variables:

QSTASH_CURRENT_SIGNING_KEY=
QSTASH_CURRENT_SIGNING_KEY_ID=

You can get these values from the Upstash Console.

3. Start the development server

npm run dev

4. Start a local tunnel

To test the application, QStash needs to send requests to your local server. You can use a tool like ngrok to create a secure tunnel to your localhost.

ngrok http 3000

Copy the resulting url and. Go to the Upstash Console and send a simple request to <ngrok-url>/api/receiver

boilerplate.detail.sections.discussion

评论 (0)

常见问题

常见问题解答 (FAQ)

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

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

还有其他问题?

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