1 ---
2 sidebar_label: "route-handler-exports-uppercase"
3 ---
4
5 export const metadata = {
6 title: `route-handler-exports-uppercase - ESLint plugin rules`,
7 }
8
9 # {metadata.title}
10
11 This rule requires API route handler exports to use uppercase HTTP method names, such as `GET` or `POST`.
12
13 ## Severity
14
15 `error`. This rule is enabled in the [recommended](../../page.mdx#recommended) preset.
16
17 ## What it Targets
18
19 This rule targets `route.ts` and `route.js` files in your project's `src/api` directory. It reports handler exports that use a lowercase HTTP method name, which Medusa ignores.
20
21 The following code is reported by the rule:
22
23 ```ts title="src/api/store/products/route.ts"
24 export const get = async (req, res) => {
25 res.json({})
26 }
27 ```
28
29 Instead, use the uppercase method name:
30
31 ```ts title="src/api/store/products/route.ts"
32 export const GET = async (req, res) => {
33 res.json({})
34 }
35 ```
36
37 ## Why it's Important
38
39 Medusa only registers handlers exported with uppercase HTTP method names. A lowercase export is ignored, so the route's handler is never reached.
40
41 Learn more in the [HTTP Methods documentation](!docs!/learn/fundamentals/api-routes/http-methods).
42
43 ## Fixable
44
45 This rule is auto-fixable. Run the linter with the `--fix` option to apply the fix automatically.