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 PathFile
/projectsapp/projects/pages/projects/index.js
/projects/newapp/projects/pages/projects/new.js
/projects/[projectId]app/projects/pages/projects/[projectId].js
/projects/[projectId]/editapp/projects/pages/projects/[projectId]/edit.js
/projects/[projectId]/tasksapp/tasks/pages/projects/[projectId]/tasks/index.js
/projects/[projectId]/tasks/newapp/tasks/pages/projects/[projectId]/tasks/new.js
/projects/[projectId]/tasks/[taskId]app/tasks/pages/projects/[projectId]/tasks/[taskId].js
/projects/[projectId]/tasks/[taskId]/editapp/tasks/pages/projects/[projectId]/tasks/[taskId]/edit.js
Idea for improving this page?Edit it on Github