Giter VIP home page Giter VIP logo

Comments (5)

ryansolid avatar ryansolid commented on June 11, 2024 1

Actually looking at it, it was intended to work. Looks like it was just a small mistake in the regex. Will get this fixed up shortly.

from solid-start.

timothyallan avatar timothyallan commented on June 11, 2024

Just to add that a workaround is to duplicate the routes folder structure for API calls, but not including any () type Route Group folders. It complicates things a lot when you've got a ton of routes, but at least it works.

Edit: Nope that actually doesn't work. The API route then works, but the initial route structure 500's with [h3] [unhandled] TypeError: Cannot read properties of undefined (reading '$GET')

Edit2: What does work is hardcoding matchAPIRoute(path, method) in routes.js to detect when the component path is being tested, and return instead of trying to find a match.

from solid-start.

ryansolid avatar ryansolid commented on June 11, 2024

Yeah in 0.5 I seperated the API route handling and simplified the matcher. However, I ended up reverting this separation later in the release which is why things don't look different even though they work completely different now. Given that I brought the routes back in I suppose it is fair to see if we can support the other syntax. I do caution in general that co-locating is a poor pattern here as we resolve all API routes before render routes, so things like catch alls won't work perhaps as you might expect when shared in the same scope as page routes. But I see very little reason not to allow them to work under things like route groups given where we landed.

from solid-start.

timothyallan avatar timothyallan commented on June 11, 2024

Cool thanks Ryan, just to add some more context, the scenario is like this:

For users to view their content, they go to: mydomain.com/viewer/userSlug, to fetch a thumbnail for SEO, the meta tags use mydomain.com/viewer/userSlug/thumb.

The /thumb needs to be a GET API request as it just 301's to a jpg, and the /viewer/userSlug route goes through a bunch of layouts/contexts using Route Groups. With the current setup, /thumb simply doesn't work anymore and 404's.

from solid-start.

timothyallan avatar timothyallan commented on June 11, 2024

Edit, just made a new issue: #1470

from solid-start.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.