File tree 1 file changed +5
-2
lines changed
libraries/WebServer/examples/PathArgServer 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3
3
#include < WebServer.h>
4
4
#include < ESPmDNS.h>
5
5
6
+ #include < uri/UriBraces.h>
7
+ #include < uri/UriRegex.h>
8
+
6
9
const char *ssid = " ........" ;
7
10
const char *password = " ........" ;
8
11
@@ -33,12 +36,12 @@ void setup(void) {
33
36
server.send (200 , " text/plain" , " hello from esp32!" );
34
37
});
35
38
36
- server.on (" /users/{}" , []() {
39
+ server.on (UriBraces ( " /users/{}" ) , []() {
37
40
String user = server.pathArg (0 );
38
41
server.send (200 , " text/plain" , " User: '" + user + " '" );
39
42
});
40
43
41
- server.on (" /users/{} /devices/{} " , []() {
44
+ server.on (UriRegex ( " ^ \\ /users\\ /([0-9]+) \\ /devices\\ /([0-9]+)$ " ) , []() {
42
45
String user = server.pathArg (0 );
43
46
String device = server.pathArg (1 );
44
47
server.send (200 , " text/plain" , " User: '" + user + " ' and Device: '" + device + " '" );
You can’t perform that action at this time.
0 commit comments