Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting handler for different HTTP Methods over multiple routing groups #2045

Open
EthanSuperior opened this issue Nov 16, 2023 · 0 comments
Labels
bug Something isn't working.

Comments

@EthanSuperior
Copy link

EthanSuperior commented Nov 16, 2023

I recently started learning server side web development so maybe I'm missed something, but I encountered something that I honestly thought would work and was surprised when it didn't, but i had a GET and POST handle split between two different routing groups and calling my POST method gave a 405 error. Might it be possible to allow some way for this type of structure to be supported? maybe using RouteConfig?

Project structure
└── routes
    ├── (needsAuth)
    │   ├── _middleware.tsx 
    │   └── score
    │       └── index.tsx # POST method handler
    ├── _middleware.tsx
    └── score
        └── index.tsx # GET method handler

My GET Handler, and POST Handler were declared like the following:

import { Handlers } from "$fresh/server.ts";
export const handler: Handlers = {
  async GET() {...},
};
import { Handlers } from "$fresh/server.ts";
export const handler: Handlers = {
  async POST(req, _ctx) {...},
};
@marvinhagemeister marvinhagemeister added the bug Something isn't working. label Nov 16, 2023
@marvinhagemeister marvinhagemeister modified the milestone: 1.5.5 Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
2 participants