Skip to content

Commit

Permalink
feat: Serve static files from the build directory
Browse files Browse the repository at this point in the history
This commit modifies the server's API file to serve static files from the "build" directory. This change adds the line `app.static("/", "./build")` to the code.

Recent user commits:
- add working assistant
- fixing
- linting fix + requirement change
- Refactor server initialization to use app.before_server_start decorator
- feat: Disable comet animation on Galaxy login page
- add working login
- database
- feat: Add Galaxy login page with background animation and email submission form

Recent repository commits:
- add working assistant
- fixing
- linting fix + requirement change
- Refactor server initialization to use app.before_server_start decorator
- feat: Disable comet animation on Galaxy login page
- add working login
- database
- feat: Add Galaxy login page with background animation and email submission form
- Update README.md
  • Loading branch information
amirrr committed Jul 13, 2024
1 parent a8c79d1 commit 88e03cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

app = Sanic("Atlas", config=AppConfig())

app.static("/", "./build")

# Initialize CORS
CORS(app, resources={r"/*": {"origins": "*"}})

Expand Down Expand Up @@ -89,11 +91,10 @@ def handle_message(data):

# Regular routes
@app.route("/")
async def index(_request: Request):
"""Serves the index.html file."""
return await response.file(
os.path.join(app.config.FALLBACK_STATIC_DIR, "index.html")
)
@app.route("/<param>")
async def route(req, param=None):
""""""
return response.text(param if param else "homepage")


@app.exception(404)
Expand Down

0 comments on commit 88e03cf

Please sign in to comment.