replace [projectId] with project name

Currently my url looks like this: http://localhost:3000/projects/asdjkfb67284v. How can I replace ithe id "asdjkfb67284v" with a unique project name? For example, I want something like http://localhost:3000/projects/my-new-project.
5 Replies
Rhys
Rhys2y ago
Hey this needs significantly more information in order to help you find a solution: - What framework are you using? - Do you control the ids or is it from another service? - Why do you need the ids to be more readable? - Why not just generate the id as the project name you want?
shikishikichangchang
NextJS (T3), I control, better user experience (breadcrumbs that use the url), havent thought about it (using cuid from prisma)
cje
cje2y ago
Give your model a unique field for the name, base the slugs on that instead of id
Navaneeth
Navaneeth2y ago
better to make slug the id in this case
shikishikichangchang
thanks guys
Want results from more Discord servers?
Add your server