tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
553 stars 20 forks source link

Does it not work for app dir route handlers? #178

Closed rafbgarcia closed 8 months ago

rafbgarcia commented 8 months ago

Hi, thanks for the lib! <3

Nextjs-routes works great with pages but it's not generating the type for a route handler I created.

Is this accurate? Or should it work fine for route handlers too?

Thanks!

tatethurston commented 8 months ago

Thanks @rafbgarcia. Checkout https://github.com/tatethurston/nextjs-routes/issues/170 and let me know if you still have questions.

rafbgarcia commented 8 months ago

@tatethurston thanks! I have a question, I haven't tested NextJS typed links yet, but it only seems to support the Link component.

However, I find nextjs-routes very useful when I need to generate a route in other places, such as using the route() function in middleware.ts, as it gives me confidence that the route is correct.

Can NextJS solution do that?

Also, nextjs-routes already works for the app directory, the only issue I faced so far was this one, that it doesn't type the route handlers.

Thanks again :)

tatethurston commented 8 months ago

Also, nextjs-routes already works for the app directory, the only issue I faced so far was this one, that it doesn't type the route handlers.

Per https://github.com/tatethurston/nextjs-routes/issues/170 I believe there may be a few additional changes necessary when using the app directory. Personally, I haven't used the app router non trivially yet, so I have some knowledge gaps here.

That said, if you're you're running with this and find it covers some use cases that Next's experimental solution doesn't, I'm happy to add functionality to cover any gaps or rough edges you run into.

I'll ship route handler support in a moment.

rafbgarcia commented 8 months ago

@tatethurston works great, thank you very much!! ❤️