Controller request URL format and public route names
Key Takeaway
In a controller request URL such as Hello-World, the function part is the route name passed first to server.get or server.post. It is not the name of the template the route renders.
A B2C Commerce controller is a server-side script that handles storefront requests as routes. The storefront reaches each route through a URL that joins the controller name and the function name with a hyphen, such as Hello-World. If you know this naming pattern, you can tell which controller code runs for a given URL. You can also build links to your own routes.
What a controller is
Controllers are server-side scripts that handle storefront requests. A controller processes each request as a route and generates a response. For example, when a shopper clicks a category menu item or enters a search term, a controller runs and renders a page.
A controller is a CommonJS module written in JavaScript and B2C Commerce script. Its file extension can be .js or .ds. The file must be in the controllers folder at the top level of the cartridge.