Blockstream / esplora

Explorer for Bitcoin and Liquid
MIT License
976 stars 392 forks source link

Self hosted API returns HTML #433

Open CryptoAssetRecovery opened 1 year ago

CryptoAssetRecovery commented 1 year ago

Can anyone advise why the url localhost:5000/api/blocks/tip/hash, returns: <!DOCTYPE html><head><meta charset="utf-8"><title>Block Explorer</title><meta property="og:title" content="Block explorer"><meta name="description" content="Esplora Block Explorer"><base href="/"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="img/favicon.png"><link rel="stylesheet" href="bootstrap.min.css"><link rel="stylesheet" href="style.css"></head><body lang="en" dir="ltr"><div id="explorer"></div><script src="app.js" async></script></body>

Im sure Im not configuring the server right somewhere, any pointers?

anmode commented 1 year ago

The response you are receiving indicates that you are hitting an HTML endpoint rather than an API endpoint. The HTML code you receive is the default template for a block explorer web application that is built using a web framework like Bootstrap.

If you are trying to retrieve the latest block hash of your blockchain using the URL localhost:5000/api/blocks/tip/hash, you may want to check the following things to ensure that the API endpoint is configured correctly:

Server Configuration: Make sure that the server is running on port 5000 and that it is configured to serve the API endpoint you are trying to access. If you are using a web framework, make sure that the API endpoint is properly registered in the routing configuration.

API Endpoint Implementation: Ensure that the implementation of the API endpoint is correct and that it returns the expected data in the correct format (e.g., JSON).

API Documentation: If you are using a third-party API, make sure that you are using the correct endpoint URL and that it is documented correctly in the API documentation.

If you still can't retrieve the block hash from the API, you may want to check the server logs for any error messages that could give you a clue about the issue. If you continue to have trouble, please provide more context or share your code and configuration files, so I can better understand the problem and provide a more specific solution.

805983439 commented 1 year ago

Can anyone advise why the url localhost:5000/api/blocks/tip/hash, returns: <!DOCTYPE html><head><meta charset="utf-8"><title>Block Explorer</title><meta property="og:title" content="Block explorer"><meta name="description" content="Esplora Block Explorer"><base href="/"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="img/favicon.png"><link rel="stylesheet" href="bootstrap.min.css"><link rel="stylesheet" href="style.css"></head><body lang="en" dir="ltr"><div id="explorer"></div><script src="app.js" async></script></body>

Im sure Im not configuring the server right somewhere, any pointers?

55272

805983439 commented 1 year ago

leos.mn56@gmail.com