web-server-chrome icon indicating copy to clipboard operation
web-server-chrome copied to clipboard

How to respond to request within app?

Open thatcomputerguy0101 opened this issue 6 years ago • 1 comments

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:

  1. How do I set up a handler to serve from a folder within the app package
  2. 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)

thatcomputerguy0101 avatar Aug 18 '19 17:08 thatcomputerguy0101

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.

thatcomputerguy0101 avatar Aug 18 '19 19:08 thatcomputerguy0101