```js // @noErrors import { applyReroute } from '@sveltejs/kit/adapter'; ``` ## applyReroute
Available since 2.51.0If your deployment platform supports splitting your app into multiple functions, you should run this in a middleware that runs before the main handler to reroute the request to the correct function and [generate a server-side manifest](/docs/kit/@sveltejs-kit#Builder) with the `rerouteMiddleware` option set to `true`. ```js // @errors: 7031 import { applyReroute } from '@sveltejs/kit/adapter'; // replace __HOOKS__ with the path to the reroute hook obtained from `builder.getReroutePath()` import { reroute } from '__HOOKS__'; export default function middleware(request) { return applyReroute(request.url, reroute); } ```