Development versus Production - routing - a route with params works on production but not on development

Hi,

When I click on a link in the production environment it goes to …./Reports?reporttype=1 when i try the same in the development / local environment it tries to go to …/Reports/?reportype=1 and i get a 404 error. (ie it adds a trailing “/” between page and parameter when in development but not in production)

Would appreciate any suggestions?

thanks

Your routing setup must be wrong. That is not a routed url
If routing was set correctly for your url would be :

/Reports/1

Please show your routing setup,server type and how you are setting the link in App Connect

<Many Thanks Brian,

NodeJS, mySQL, wappler version 7.3.6

You need to add the route parameters to the route.

You need it to be
Reports/:reporttype

This will add the parameter.

It is all explained in this video

Thanks Brian, how does it work for two params?

I’ve tried adding the 2nd param as :UQNID and it seems to work and when i go to use that route both parameters come up, but when i add a param for each say 2 for one and 4 for the other it shows Reports/24…. if I change so that param one is 24 and param two is 3 then it shows Reports/243 and I cant only specifiy 1 param but can do 0 and 4 which gives Reports/04.

Any guidance most appreciated,

Thanks,

Just define two like this.

Reports/:reporttype/:secondparam

You can also add a ? to the parameter to make it optional.

So,for example:

Reports/:reporttype/:secondparam

Must have both parameters or it will return a 404 error

Reports/:reporttype/:secondparam?

Means reporttype us mandatory, secondparam is optional

1 Like

Hi Brian, sorry for the delay - just tried again with both params as optional

but it doesnt seem to work because if when using it i select the 1st param and set it to 1 or if i select the 2nd param and set it to 1 then the result is the same Reports/1.. which doesnt seem right!!!

Appreciate any thoughts/solutions - maybe you cant have 2 optional params??

Thanks

if i enter 0 for the 1st param and 1 for the second then i get Reports/0/1

You can’t have an optional parameter in the middle of the route path like:

Reports/:param1?/:param2?

Maybe explain a little more how are these parameters used and which of them are needed?

Ok Thanks Teodor, I’m re-writing to have just one optional parameter

Hi, I now have the problem that when i click on the button with ReportHome/1 it fails and doesnt launch the ReportHome page. If i remove the /1 it launches the page ok (w/o the param).(i changed the page Reports to ReportHome)

Would really appreciate any guidance on how to fix or debug please.

NodeJS,MYSQL, Windows, Heroku wappler 7.3.6

the route properties

the file (app/config/routes)

Ive tried removing the page access control and has no effect

The code calling to route to ReportHome - note there are 2 buttons - the 2nd one is the original (although with the param removed for testing) and a browser goto, the top one i added as i thought the problem might be i needed a link rather than goto… but when with param neither work

Where are these buttons/links located? Are they on the same (ReportHome) page or on another page?
What do you mean by "it fails"? What error do you see?

The buttons are on another page (CompanyDashboard)

When i click on the button it takes me to what looks like an unformatted version of the associated Layout page

Should't the link to your page be href="/ReportHome/1" - with a leading /? And also - are both pages using the same layout/main page?

I just tried that and also changed the goto to have the param and leading / but same result

Are you sure your routes are well generated and uploaded to the server?

Also can you post a screenshot of the routings panel, where i can see all your routes?

I think the routes are all uploaded ok.

There are lots of routes

There are deliberately a ReportHome and a Results pages

Can you please send me a link to your page where i can inspect what is going on?

Can you link to my local development ? if so how do i do that. Alternatively i have a production version (with no customers yet) so can provide you a userid and password. what works best?

You can send me the user/pass in a personal message.