| 130 | } |
| 131 | |
| 132 | void startWebServer() |
| 133 | { |
| 134 | if(serverStarted) { |
| 135 | return; |
| 136 | } |
| 137 | |
| 138 | server.listen(80); |
| 139 | server.paths.set("/", onIndex); |
| 140 | server.paths.set("/api", onApiDoc); |
| 141 | server.paths.set("/api/sensors", onApiSensors); |
| 142 | server.paths.set("/api/output", onApiOutput); |
| 143 | server.paths.set("/config", onConfiguration); |
| 144 | server.paths.setDefault(onFile); |
| 145 | serverStarted = true; |
| 146 | |
| 147 | if(WifiStation.isEnabled()) |
| 148 | debugf("STA: %s", WifiStation.getIP().toString().c_str()); |
| 149 | if(WifiAccessPoint.isEnabled()) |
| 150 | debugf("AP: %s", WifiAccessPoint.getIP().toString().c_str()); |
| 151 | } |