kzahel / web-server-chrome

An HTTP Web Server for Chrome (chrome.sockets API)
https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb
Other
1.24k stars 275 forks source link

Add support for sharing multiple different folders at the same time #62

Open lsn793 opened 8 years ago

lsn793 commented 8 years ago

At this moment I can share the only one folder. To share several different folders I have to create several WSC.WebApplication objects. This is not friendly. The only WSC.WebApplication object should have posibility to share multiple folders simultaneously.

kzahel commented 8 years ago

Why can't you pass in several handlers?

   var handlers = [
                        ['/area1/(.*)', WSC.DirectoryEntryHandler.bind(null, fs)],
    ['/area2/(.*)', WSC.DirectoryEntryHandler.bind(null, fs2)]
]
kzahel commented 8 years ago

Ah, I see there could be a problem https://github.com/kzahel/web-server-chrome/blob/master/handlers.js#L161

I'm using this.request.path instead of the argument to .get(regexpmatch, ...)