I'm looking for some advice for my Webserver.
from my application i get a POST request with an empty body. So that means i get a POST request and all the info I need I get from the URL which my application is sending to.
All reachable URL's should cover those cases, but without initialising each and everyone, one by one:
IP/command/on or off/number between 1-n
So for Example if i want to turn off my led on pinnumber 20 i send my POST request on the following URL:
IP/command/off/20.
At first I fixed this problem by the following line of Code:
But now i can't use the WebServer.h library anymore and to be honest, this wasnt really a good solution, since the only thing that happened is, that i allow number in the URL between 1 and 9.
Now i want to ask if someone knows a more "elegant" way to work around that problem.
I had to switch over to https. And I’m using a 3rd party library, since I didn’t found a arduino Library. This library provides a wrapper, so I can use it with the WebServer.h API so I don’t have to rewrite my code
So basically i got an application. and i want the application to communicate with my webserver. To communicate with my webserver i use a 3rd-person library to implement HTTPS.
The communication im talking about should be done by a bodyless HTTPS POST request. All my Information I should receive by getting all the Data in my URL.
Basically i want to give the application 2 parameters to choose of. 1.= On or Off and 2. = number between 1 and x(lets say 32).
that means i send a on signal for the number 5(could be a LED or anything else).
But before I'm able to reach my webserver with this URL I have to initialize this exact URL with the server.on() function.
and there's my problem. I dont want to initialize every URL one by one. Is there a possibillity without using UriRegex where i can say = just accept requests by the number between 1 and 32.
Yeah i would also do the same. But since i didn't make the app, i cant really change the way it is. So I'm getting a path and not really a value. I think this makes it more clear.
Maybe with server.onNotFound then in its handler function you parse server.uri() to get the parameters? Just an idea, I really don't know if that will work