Routing Conventions
We copied the conventions from Ruby on Rails, where it has stood the test of time. The Blitz CLI uses these conventions for code scaffolding. If you don’t like them, you are free to deviate and do anything you want.
- Entity names are plural
- Each of the following have their own page: entity index, single entity show page, new entity page, and edit entity page
entityId
is used from the dynamic url slug
Example: You have a
Project
model and a Task
model which belongs to a Project
. Your routes will be:
URL Path | File |
---|---|
/projects | app/projects/pages/projects/index.js |
/projects/new | app/projects/pages/projects/new.js |
/projects/[projectId] | app/projects/pages/projects/[projectId].js |
/projects/[projectId]/edit | app/projects/pages/projects/[projectId]/edit.js |
/projects/[projectId]/tasks | app/tasks/pages/projects/[projectId]/tasks/index.js |
/projects/[projectId]/tasks/new | app/tasks/pages/projects/[projectId]/tasks/new.js |
/projects/[projectId]/tasks/[taskId] | app/tasks/pages/projects/[projectId]/tasks/[taskId].js |
/projects/[projectId]/tasks/[taskId]/edit | app/tasks/pages/projects/[projectId]/tasks/[taskId]/edit.js |