swifter icon indicating copy to clipboard operation
swifter copied to clipboard

Question for loading index.html + subdirrectories

Open Jean-PhilippeDESCAMPS opened this issue 2 years ago • 1 comments

Hello 👋

Im trying to make an app that embed web app code. I have added in my project source 2 folders:

  • One for the app
  • One for the authentication process

Im trying to start a server to execute my authentication app first. let server = HttpServer() do { try server.start() let bundlePath = Bundle.main.bundlePath var frontEndAuthPath = bundlePath frontEndAuthPath.append("/frontend-auth/") server["/auth"] = shareFilesFromDirectory(frontEndAuthPath) server["/auth/static/"] = shareFilesFromDirectory(frontEndAuthPath.appending("static/")) server["/auth/static/js"] = shareFilesFromDirectory(frontEndAuthPath.appending("static/js")) server["/auth/static/css"] = shareFilesFromDirectory(frontEndAuthPath.appending("static/css")) server["/auth/static/media"] = shareFilesFromDirectory(frontEndAuthPath.appending("static/media")) print("Server has started ( port = \(try server.port()) ). Try to connect now...") } catch (let error) { print(error.localizedDescription) }

My problem is that the web app is not started because it not found static/js/files

I saw different methods : shareFilesFromDirectory or directoryBrowser.

How can I run correctly my server ?

Jean-PhilippeDESCAMPS avatar Sep 06 '23 14:09 Jean-PhilippeDESCAMPS

same issue

zsinba avatar Nov 30 '23 05:11 zsinba