Skip to content

Question for loading index.html + subdirrectories #541

Open
@Jean-PhilippeDESCAMPS

Description

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions