It's probably easier to just wire your Pi into the router and use NetworkTables for communications. If you use
pynetworktables2js, then you can talk directly to NetworkTables from javascript... and of course, if you're doing that, you don't even really need to run the web server on a Pi unless you want to.