/next-use-warmroutes

Next.js hook which gives developers control over when to warm up a specific serverless / SSR route.

Primary LanguageTypeScript

Next.js Warm Routes

Next.js useWarmRoutes hooks ensures that your routes are warm so that you never have to start from a cold start again.

Define a route mapping to ensure that a list of routes gets called with a pre-flight request when the current route matches the route defined in the object.

Usage

// Use this at the root of your Next.js application, _app.tsx for maximum effectiveness.
useWarmRoutes({
  "/*": ["/articles/*", "/api/articles"],
});

Note: keys defined in this object should be glob patterns.