Add a route for / that points users to documentation.

This commit is contained in:
Jude Nelson
2017-05-04 18:29:27 -04:00
parent 8c72d4a93d
commit a95f005037

View File

@@ -2424,6 +2424,16 @@ class BlockstackAPIEndpointHandler(SimpleHTTPRequestHandler):
return self._send_headers(status_code=401, content_type='text/plain')
def GET_help(self, session, path_info):
"""
Top-level GET request
"""
template = """<html><header></header><body>Blockstack RESTful API<br><a href="https://github.com/blockstack/blockstack-core/tree/master/api">Documentation</a></body></html>"""
self._send_headers(status_code=200, content_type='text/html')
self.wfile.write(template)
return
def _dispatch(self, method_name):
"""
Top-level dispatch method
@@ -3203,6 +3213,20 @@ class BlockstackAPIEndpointHandler(SimpleHTTPRequestHandler):
},
},
},
r'^/$': {
'routes': {
'GET': self.GET_help,
},
'whitelist': {
'GET': {
'name': '',
'desc': 'help',
'auth_session': False,
'auth_pass': False,
'need_data_key': False,
},
},
},
r'^/v1/.*$': {
'routes': {
'OPTIONS': self.OPTIONS_preflight,