Skip to content

Mounting static to "/" #1516

@taoofshawn

Description

@taoofshawn

First check

  • [x ] I used the GitHub search to find a similar issue and didn't find it.
  • [x ] I searched the FastAPI documentation, with the integrated search.
  • [x ] I already searched in Google "How to X in FastAPI" and didn't find any information.

Description

I would like the api paths to be under "/api" and the static pages loaded by the initial load at "/". When I do this, it seems that the app.mount takes over all sub-paths and the /api paths get ignored.

I mostly see people mounting under /static instead i.e. app.mount('/static',xxx)

How would I get the js/html front end to load and appear to be at http://server.com instead of http://server.com/static/ ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions