route-file-naming - ESLint plugin rules
This rule requires API route handlers to be exported from a route.ts or route.js file under src/api.
Severity#
error. This rule is enabled in the recommended preset.
What it Targets#
This rule targets files in your project's src/api directory. It reports HTTP method handlers exported from a file that isn't named route.ts or route.js, and route files that export no HTTP method handler.
The following code is reported by the rule:
Instead, export the handler from a route file:
Why it's Important#
Medusa only registers HTTP method handlers exported from or files. Handlers placed in other files are never reached, so the route won't work as expected.
Learn more in the API Routes documentation.
Fixable#
This rule isn't auto-fixable.
Was this page helpful?