Next.js Discord

Discord Forum

Route Alias

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hey,

I'm currently trying to achive a similar behaviour most chat apps these days have. If you open them at / this will be the "new chat page". If you type in the first message, you will be redirected to /chat/uuid or smth. Now the pages are exactly the same. I'm using Nextjs 14 and the app router. What's the best way to achive this?
I thought about something like / is just a alias to /chat/new which i could build with the directory structure. I didn't find something about route aliases tho. Whats the best practice here? Making the full page a component?

Thank you ❤️

1 Reply