1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
// Main page template. Implements BasePage methods.
{% import "github.com/valyala/fasthttp" %}
{% code
type MainPage struct {
CTX *fasthttp.RequestCtx
}
%}
{% func (p *MainPage) Title() %}
This is the main page
{% endfunc %}
{% func (p *MainPage) Body() %}
<h1>Main page</h1>
<div>
Click links below:
<ul>
<li><a href="/table?rowsCount=42">Table page</a></li>
<li><a href="/unknown-page">Error page</a></li>
</ul>
</div>
<div>
Some info about you:<br/>
IP: <b>{%s p.CTX.RemoteIP().String() %}</b><br/>
User-Agent: <b>{%z p.CTX.UserAgent() %}</b><br/>
</div>
{% endfunc %}
|