Search

Installation

How to install Next Query in your project

To install Next Query in your project, follow these steps:

1. Install the package

Begin by adding Next Query to your project:

npm install @bigbang-sdk/next-query

2. Mount handler

Next Query uses API route handlers under the hood to process requests and handle revalidations.

To enable this, you need to set up a catch-all route handler in your Next.js project to handle API requests made by Next Query.

Create a new file in your project to match the route /api/next-query/*/. This route will handle all fetch requests from Next Query.

import { revalidateTag } from "next/cache";
import { routeHandler } from "@bigbang-sdk/next-query";

export const { GET, POST } = routeHandler(revalidateTag);

Made with

by Bigbang