This repository contains
- a basic entry/overview/landing web page template for a HAPI server (Demo) and
- code for a landing page with a advanced user interface for browsing servers and datasets, downloading data from your browser, generating ~10-line IDL/MATLAB/Python scripts to download data, and creating preview plots (Demo).
To use the basic landing page with your HAPI server, download single.htm and fill in the placeholders prefixed by __, save as index.htm and place in the directory associated with responses to a URL that ends in /hapi.
To use the landing page with an advanced user interface,
git clone https://github.com/hapi-server/server-uiThen, edit all.txt and configure your server so that responses to a URL that ends in /hapi are associated with the sever-ui directory.
Or, for testing, cd to the server-ui directory, edit all.txt, and execute
cd server-ui; python2 -m SimpleHTTPServer
# or
cd server-ui; python3 -m http.server
# or
cd server-ui; npm install; npm start
and open http://localhost:8000/ in a web browser.
By default, the list of servers shown at http://localhost:8000/ will be that in https://github.com/hapi-server/servers/blob/master/all_.txt.
To use your own list, rename all_.txt to all.txt and enter the URL of your HAPI server in all.txt.
You can pass the URL of a server to create a menu for by passing it as a parameter in the hash. The following will cause the UI to show datasets in the SSCWeb HAPI server.
http://hapi-server.org/servers/#server=https://hapi-server.org/servers/SSCWeb/hapi
Note that this will only work if the server(s) allow CORS or the proxy server below is used.
If a server in all.txt or the server passed as a URL parameter does not allow CORS, you will need to use a proxy server to access resources from that server.
A server with a proxy can be run on port 8000 using
npm install
node server/server.js --port 8000
To constrain URLs that can be proxied, see node server/server.js --help
By default, if an request to URL fails, an attempt to retrieve it is made via the proxy request proxy?url=URL. The URL for the proxy is set in the header of index.htm.
Please submit issues and feature requests to the issue tracker.