Skip to content

Fix #133: Add root route to fix 404 error on backend root URL#188

Open
hkc5 wants to merge 2 commits into666ghj:mainfrom
hkc5:main
Open

Fix #133: Add root route to fix 404 error on backend root URL#188
hkc5 wants to merge 2 commits into666ghj:mainfrom
hkc5:main

Conversation

@hkc5
Copy link

@hkc5 hkc5 commented Mar 14, 2026

Problem

When accessing the backend at 0.0.0.0:5001, users receive a 404 error. This is confusing because the server appears to start successfully but the root URL returns nothing.

Solution

Added a root route (/) that returns:

  • Service name and status
  • Available endpoints information
  • API route prefixes

Changes

  • Modified backend/app/__init__.py to add an @app.route('/') endpoint

Testing

The root endpoint now returns:

{
  "service": "MiroFish Backend",
  "status": "running",
  "version": "1.0.0",
  "endpoints": {
    "health": "/health",
    "api": {
      "graph": "/api/graph",
      "simulation": "/api/simulation",
      "report": "/api/report"
    }
  }
}

Fixes #133

- Added a root route '/' that returns service info and available endpoints
- Fixes issue 666ghj#133 where accessing 0.0.0.0:5001/ returned 404
- The root endpoint now provides helpful information about available API endpoints
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 14, 2026
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 15, 2026
@hkc5
Copy link
Author

hkc5 commented Mar 15, 2026

Hi @666ghj @hzr1937,

This PR fixes the 404 error when accessing the backend root URL (0.0.0.0:5001).

The issue was that Flask only had routes for /health and /api/*, causing confusion for users who expected to see something when accessing the backend directly.

Added a simple root route that returns service info and available endpoints.

Ready for review when you have time!

Thanks

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

本地部署,启动已经显示成功了,访问却失败

1 participant