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
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?
NextJS (T3), I control, better user experience (breadcrumbs that use the url), havent thought about it (using cuid from prisma)
Give your model a unique field for the name, base the slugs on that instead of id
better to make slug the id in this case
thanks guys