mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-05-18 07:19:27 +00:00
- Create src/api/v1/search.py with search() handler
- Add /search/{hash:str} route to v1 router
- Add tests/test_search_api.py for integration tests
Note: Tests fail until Task 3 initializes search_repository in app state.
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from fastapi import APIRouter
|
|
|
|
from . import blocks, fork_choice, health, index, search, transactions
|
|
|
|
|
|
def create_v1_router() -> APIRouter:
|
|
"""
|
|
Route order must be preserved.
|
|
"""
|
|
router = APIRouter()
|
|
|
|
router.add_api_route("/", index.index, methods=["GET", "HEAD"])
|
|
|
|
router.add_api_route("/health/stream", health.stream, methods=["GET", "HEAD"])
|
|
router.add_api_route("/health", health.get, methods=["GET", "HEAD"])
|
|
|
|
router.add_api_route("/search/{hash:str}", search.search, methods=["GET"])
|
|
|
|
router.add_api_route("/transactions/stream", transactions.stream, methods=["GET"])
|
|
router.add_api_route(
|
|
"/transactions/list", transactions.list_transactions, methods=["GET"]
|
|
)
|
|
router.add_api_route("/transactions/search", transactions.search, methods=["GET"])
|
|
router.add_api_route(
|
|
"/transactions/{transaction_hash:str}", transactions.get, methods=["GET"]
|
|
)
|
|
|
|
router.add_api_route("/fork-choice", fork_choice.get, methods=["GET"])
|
|
|
|
router.add_api_route("/blocks/stream", blocks.stream, methods=["GET"])
|
|
router.add_api_route("/blocks/list", blocks.list_blocks, methods=["GET"])
|
|
router.add_api_route("/blocks/{block_hash:str}", blocks.get, methods=["GET"])
|
|
|
|
return router
|