If you are willing to help hiproxy to write documentation, please contact zdying@live.com, thank you!
Introduction
You can visit http://127.0.0.1:<port>/ to watch basic informations of the service after it finished starting.
Except that page, hiproxy support a feature for adding new page. For example, plugin hiproxy-plugin-dashboard add a page to hiproxy for showing service information and modifying configuration files, which is at http://127.0.0.1:<port>/dashboard/.
Configuration Content
Page route configuration include: route rules and renderer. Then are:
- Route Rules(route):
<String>, URL pattern, i.e.'/dashboard(/:page)'. See https://www.npmjs.com/package/url-pattern for details. - Renderer(render):
<Function>, for rendering a page. It accept three parameters:(route, request, response).
Renderer, render() Method
render() method should be invokded with three parameters, (route, request, response), while user visit the corresponding page.
- route:
<Object>, arguments object from route pattern. For example,/test(/:pageName)pattern cause the object{pageName: 'home'}while/test/homeis visiting. - request:
<http.IncomingMessage>,http request instance. - response:
<http.ServerResponse>,http response instance.
Example
A entire example is below:
1 | { |