web-server-chrome
web-server-chrome copied to clipboard
How to respond to request within app?
I have most of this running within an app that I'm working on, but I do not understand how the request handlers work. Two major questions:
- How do I set up a handler to serve from a folder within the app package
- How do I set up a handler to execute some script (say, using a chrome app API) and return a resulting JSON object as the response
I think I understand that the argument for the "get" function (path) is the first match from the regexp from the handlers array, but after that, I'm lost. (Also, I do have valid handlers, they just don't do anything right now)
Actually, I think I figured out problem 1, (using WSC.FileSystem and WSC.DirectoryEntryHandler after getting the directory object), but index.html is not being served when a directory path is provided. I still am confused about what to do for number 2 though.