Custom routes a with a custom template

Hello,
I’m working on a product section where I would like to have a single-product “dynamic page”.

I’ve an API that returns all info of single product by slug parameter

I’ve created the “product” page just to assign it to a custom template

Example:
www.mydomain.com/product

I would like to be able to create single pages without having to generate it manually.

For example:
www.mydomain.com/product/some_product_title

I always have a 404 since the page “/ some_product_title” does not exist, but I would like this to be dynamic since my intention is to retrieve the URL to receive the data from the API on the fly and generate the page

Si esto fuera laravel o symfony, por ejemplo, sería un controlador con una ruta donde pudiera recibir parametros, como por ejemplo:

If this were laravel or symfony, for example, it would be a controller with a path where it could receive parameters, such as:

Route :: get ('/product/ {title}', function ($title) {
     return $title
});

This topic was automatically closed after 42 days. New replies are no longer allowed.