-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Point webserver to dataDirectory? #59
Comments
I recently found a solution !!! Every time web server detects GET request it calls onRequest() method and returns in request path parameter, a part of request link following http://localhost:8080 sendResponse() method in the documentation example is inclosed into onRequest() method, so every time I’m requesting different file, I can overwrite parameter path in sendResponse() method So, requesting file from my dataDirectory I have to: IMPORTANT NOTE!!! I enclosed sendResponse() method into 3 sec timeout, otherwise path parameter from onRequest() in the most of cases arrives later than fires sendRespose() and the target link isn’t updated. If anybody will offer some fancy way to make it with async or promise - will be great! Here is my code (for my Vuejs app), that I’m calling once when the app launched to start a server:
|
Dear @bykof , you have a great solution, I was able to integrate it into my app, but the only very valuable thing I can't handle is:
I need to point webserver to device dataDirectory (e.g. cordova.file.dataDirectory), to be able put there several files (e.g. http://localhost:8084/myimage.png etc) and after call them within the app.
My I ask you a favor to implement this feature?
Can I collaborate/donate your project in any way?
I saw that GCDWebServer has a method addGETHandlerForBasePath to do it
https://stackoverflow.com/questions/30984084/gcdwebserver-static-files-from-documents
Unfortunately I don't have enough skills to modify your plugin ((
The text was updated successfully, but these errors were encountered: