[{"id":"/docs/fragno/for-library-authors/features/dependencies-and-services","type":"page","content":"Config, Dependencies, and Services\n","breadcrumbs":["Docs","Fragno","For Library Authors","Features"],"url":"/docs/fragno/for-library-authors/features/dependencies-and-services"},{"id":"/docs/fragno/for-library-authors/features/dependencies-and-services-2","content":"Using `defineRoutes` to work with Dependencies and Services\n","type":"heading","url":"/docs/fragno/for-library-authors/features/dependencies-and-services#using-defineroutes-to-work-with-dependencies-and-services"},{"id":"/docs/fragno/for-library-authors/features/dependencies-and-services-17","content":"Use `defineRoutes(fragmentDefinition)` to define routes that have access to your Fragment's config,\ndependencies, and services.\n","type":"text","url":"/docs/fragno/for-library-authors/features/dependencies-and-services#using-defineroutes-to-work-with-dependencies-and-services"},{"id":"/docs/fragno/for-library-authors/features/dependencies-and-services-18","content":"Because `defineRoutes` is typed from the fragment definition, you usually don't need to define\nseparate `Deps`/`Services` types just to get good inference in your route handlers.\n","type":"text","url":"/docs/fragno/for-library-authors/features/dependencies-and-services#using-defineroutes-to-work-with-dependencies-and-services"},{"id":"/docs/fragno/for-library-authors/features/route-definition","type":"page","content":"Route Definitions\n","breadcrumbs":["Docs","Fragno","For Library Authors","Features"],"url":"/docs/fragno/for-library-authors/features/route-definition"},{"id":"/docs/fragno/for-library-authors/features/route-definition-19","content":"The `defineRoutes` factory pattern can be used to split route definitions into multiple files. The\n`.withRoutes` method can be used to combine them into a single array when instantiating the\nserver-side Fragment.\n","type":"text","url":"/docs/fragno/for-library-authors/features/route-definition#basic-route-structure"},{"id":"/docs/fragno/for-library-authors/features/route-definition-18","content":"You can either pass the runtime definition for type inference: `defineRoutes(fragmentDefinition)`,\nor you can use the generic overload: `defineRoutes<typeof fragmentDefinition>()`. The latter is\nuseful if importing the runtime value would result in circular dependencies.\n","type":"text","url":"/docs/fragno/for-library-authors/features/route-definition#basic-route-structure"},{"id":"/docs/fragno/for-library-authors/getting-started","type":"page","content":"Getting Started\n","breadcrumbs":["Docs","Fragno","For Library Authors"],"url":"/docs/fragno/for-library-authors/getting-started"},{"id":"/docs/fragno/for-library-authors/getting-started-24","content":"Routes are typically defined using `defineRoutes(todosDefinition)`, which gives you access to a\ntyped route factory context (config, deps, services) and a `defineRoute` helper. Route options are:\n`method`, `path`, `inputSchema`, `outputSchema`, `handler`, `errorCodes`, and `queryParameters`. See\nour Route Definition page for\nadditional details.\n","type":"text","url":"/docs/fragno/for-library-authors/getting-started#step-3-define-routes"}]