From a980f4c08b108076848d579d9ef302d31b8dc54a Mon Sep 17 00:00:00 2001 From: PatrickJS Date: Sun, 5 May 2024 16:48:17 -0700 Subject: [PATCH] docs(plugins): rename as Qwik Plugins --- .../src/routes/docs/(qwikcity)/advanced/plugins/index.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/docs/src/routes/docs/(qwikcity)/advanced/plugins/index.mdx b/packages/docs/src/routes/docs/(qwikcity)/advanced/plugins/index.mdx index 200519da64a..7e911039520 100644 --- a/packages/docs/src/routes/docs/(qwikcity)/advanced/plugins/index.mdx +++ b/packages/docs/src/routes/docs/(qwikcity)/advanced/plugins/index.mdx @@ -1,5 +1,5 @@ --- -title: Plugins | Qwik City +title: Qwik Plugins | Qwik City description: Learn about advanced routing in Qwik City, including 404 page handling, grouped layouts, named layouts, nested layouts, and plugin.ts files. contributors: - patrickjs @@ -7,7 +7,11 @@ updated_at: '2024-05-05T16:20:00Z' created_at: '2024-05-05T16:20:00Z' --- -# Plugins with `plugin@.ts` +# Qwik Plugins +Qwik plugins, named as `plugin.ts` or `plugin@.ts`, handle incoming requests prior to root layout execution and are located in the `src/routes` directory. Request handlers like `onRequest`, `onGet`, `onPost` in these plugins are called before `server$` functions. For multiple plugins, `plugin.ts` handlers execute first, followed by `plugin@.ts` handlers in alphabetical order. Middleware functions should be defined in `plugin.ts` to ensure execution for all requests. + + +# `plugin@.ts` `plugin.ts` and `plugin@.ts` files can be created in the root of the `src/routes` directory to handle any incoming request before even the root layout executes.