Skip to content

Commit 510c194

Browse files
committed
Update API docs
1 parent ec4d97e commit 510c194

File tree

2 files changed

+65
-39
lines changed

2 files changed

+65
-39
lines changed

_layouts/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
<a href="/"><h1 class="header">Web</h1></a>
2121
<p class="header">The easiest way to create web applications with Go</p>
2222
<ul>
23-
<li><a href="https://github.com/hoisie/web">View On GitHub</a></li>
2423
<li><a href="index.html">Quickstart</a></li>
25-
<li><a href="api.html">API Docs</a></li>
2624
<li><a href="tutorial.html">Tutorial</a></li>
25+
<li><a href="api.html">API Docs</a></li>
26+
<li><a href="https://github.com/hoisie/web">View On GitHub</a></li>
2727
</ul>
2828
</header>
2929
<section>

api.html

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ <h2 id="pkg-index">Index</h2>
6666
<dd><a href="#Get">func Get(route string, handler interface{})</a></dd>
6767

6868

69+
<dd><a href="#Match">func Match(method string, route string, handler interface{})</a></dd>
70+
71+
6972
<dd><a href="#Post">func Post(route string, handler interface{})</a></dd>
7073

7174

@@ -147,6 +150,9 @@ <h2 id="pkg-index">Index</h2>
147150
<dd>&nbsp; &nbsp; <a href="#Server.Get">func (s *Server) Get(route string, handler interface{})</a></dd>
148151

149152

153+
<dd>&nbsp; &nbsp; <a href="#Server.Match">func (s *Server) Match(method string, route string, handler interface{})</a></dd>
154+
155+
150156
<dd>&nbsp; &nbsp; <a href="#Server.Post">func (s *Server) Post(route string, handler interface{})</a></dd>
151157

152158

@@ -214,7 +220,7 @@ <h2 id="pkg-variables">Variables</h2>
214220

215221

216222

217-
<h2 id="Close">func <a href="/target/web.go?s=14156:14168#L496">Close</a></h2>
223+
<h2 id="Close">func <a href="/target/web.go?s=14155:14167#L495">Close</a></h2>
218224
<pre>func Close()</pre>
219225
<p>
220226
Close stops the main server.
@@ -224,7 +230,7 @@ <h2 id="Close">func <a href="/target/web.go?s=14156:14168#L496">Close</a></h2>
224230

225231

226232

227-
<h2 id="Delete">func <a href="/target/web.go?s=15415:15461#L536">Delete</a></h2>
233+
<h2 id="Delete">func <a href="/target/web.go?s=15598:15644#L540">Delete</a></h2>
228234
<pre>func Delete(route string, handler interface{})</pre>
229235
<p>
230236
Delete adds a handler for the &#39;DELETE&#39; http method in the main server.
@@ -234,7 +240,7 @@ <h2 id="Delete">func <a href="/target/web.go?s=15415:15461#L536">Delete</a></h2>
234240

235241

236242

237-
<h2 id="Get">func <a href="/target/web.go?s=14925:14968#L521">Get</a></h2>
243+
<h2 id="Get">func <a href="/target/web.go?s=15108:15151#L525">Get</a></h2>
238244
<pre>func Get(route string, handler interface{})</pre>
239245
<p>
240246
Get adds a handler for the &#39;GET&#39; http method in the main server.
@@ -244,7 +250,17 @@ <h2 id="Get">func <a href="/target/web.go?s=14925:14968#L521">Get</a></h2>
244250

245251

246252

247-
<h2 id="Post">func <a href="/target/web.go?s=15079:15123#L526">Post</a></h2>
253+
<h2 id="Match">func <a href="/target/web.go?s=15773:15833#L545">Match</a></h2>
254+
<pre>func Match(method string, route string, handler interface{})</pre>
255+
<p>
256+
Match adds a handler for an arbitrary http method in the main server.
257+
</p>
258+
259+
260+
261+
262+
263+
<h2 id="Post">func <a href="/target/web.go?s=15262:15306#L530">Post</a></h2>
248264
<pre>func Post(route string, handler interface{})</pre>
249265
<p>
250266
Post adds a handler for the &#39;POST&#39; http method in the main server.
@@ -254,7 +270,7 @@ <h2 id="Post">func <a href="/target/web.go?s=15079:15123#L526">Post</a></h2>
254270

255271

256272

257-
<h2 id="Put">func <a href="/target/web.go?s=15245:15288#L531">Put</a></h2>
273+
<h2 id="Put">func <a href="/target/web.go?s=15428:15471#L535">Put</a></h2>
258274
<pre>func Put(route string, handler interface{})</pre>
259275
<p>
260276
Put adds a handler for the &#39;PUT&#39; http method in the main server.
@@ -264,7 +280,7 @@ <h2 id="Put">func <a href="/target/web.go?s=15245:15288#L531">Put</a></h2>
264280

265281

266282

267-
<h2 id="Run">func <a href="/target/web.go?s=12693:12714#L440">Run</a></h2>
283+
<h2 id="Run">func <a href="/target/web.go?s=12692:12713#L439">Run</a></h2>
268284
<pre>func Run(addr string)</pre>
269285
<p>
270286
Run starts the web application and serves HTTP requests for the main server.
@@ -274,7 +290,7 @@ <h2 id="Run">func <a href="/target/web.go?s=12693:12714#L440">Run</a></h2>
274290

275291

276292

277-
<h2 id="RunFcgi">func <a href="/target/web.go?s=13963:13988#L484">RunFcgi</a></h2>
293+
<h2 id="RunFcgi">func <a href="/target/web.go?s=13962:13987#L483">RunFcgi</a></h2>
278294
<pre>func RunFcgi(addr string)</pre>
279295
<p>
280296
RunFcgi starts the web application and serves FastCGI requests for the main server.
@@ -284,7 +300,7 @@ <h2 id="RunFcgi">func <a href="/target/web.go?s=13963:13988#L484">RunFcgi</a></h
284300

285301

286302

287-
<h2 id="RunScgi">func <a href="/target/web.go?s=13596:13621#L472">RunScgi</a></h2>
303+
<h2 id="RunScgi">func <a href="/target/web.go?s=13595:13620#L471">RunScgi</a></h2>
288304
<pre>func RunScgi(addr string)</pre>
289305
<p>
290306
RunScgi starts the web application and serves SCGI requests for the main server.
@@ -294,7 +310,7 @@ <h2 id="RunScgi">func <a href="/target/web.go?s=13596:13621#L472">RunScgi</a></h
294310

295311

296312

297-
<h2 id="RunTLS">func <a href="/target/web.go?s=13209:13253#L460">RunTLS</a></h2>
313+
<h2 id="RunTLS">func <a href="/target/web.go?s=13208:13252#L459">RunTLS</a></h2>
298314
<pre>func RunTLS(addr string, config *tls.Config)</pre>
299315
<p>
300316
RunTLS starts the web application and serves HTTPS requests for the main server.
@@ -304,7 +320,7 @@ <h2 id="RunTLS">func <a href="/target/web.go?s=13209:13253#L460">RunTLS</a></h2>
304320

305321

306322

307-
<h2 id="SetLogger">func <a href="/target/web.go?s=15683:15717#L546">SetLogger</a></h2>
323+
<h2 id="SetLogger">func <a href="/target/web.go?s=16053:16087#L555">SetLogger</a></h2>
308324
<pre>func SetLogger(logger *log.Logger)</pre>
309325
<p>
310326
SetLogger sets the logger for the main server.
@@ -314,7 +330,7 @@ <h2 id="SetLogger">func <a href="/target/web.go?s=15683:15717#L546">SetLogger</a
314330

315331

316332

317-
<h2 id="Urlencode">func <a href="/target/web.go?s=16559:16604#L589">Urlencode</a></h2>
333+
<h2 id="Urlencode">func <a href="/target/web.go?s=16929:16974#L598">Urlencode</a></h2>
318334
<pre>func Urlencode(data map[string]string) string</pre>
319335
<p>
320336
Urlencode is a helper method that converts a map into URL-encoded form data.
@@ -326,7 +342,7 @@ <h2 id="Urlencode">func <a href="/target/web.go?s=16559:16604#L589">Urlencode</a
326342

327343

328344

329-
<h2 id="Context">type <a href="/target/web.go?s=855:973#L31">Context</a></h2>
345+
<h2 id="Context">type <a href="/target/web.go?s=854:972#L30">Context</a></h2>
330346
<pre>type Context struct {
331347
Request *http.Request
332348
Params map[string]string
@@ -351,7 +367,7 @@ <h2 id="Context">type <a href="/target/web.go?s=855:973#L31">Context</a></h2>
351367

352368

353369

354-
<h3 id="Context.Abort">func (*Context) <a href="/target/web.go?s=1361:1411#L47">Abort</a></h3>
370+
<h3 id="Context.Abort">func (*Context) <a href="/target/web.go?s=1360:1410#L46">Abort</a></h3>
355371
<pre>func (ctx *Context) Abort(status int, body string)</pre>
356372
<p>
357373
Abort is a helper method that sends an HTTP header and an optional
@@ -364,7 +380,7 @@ <h3 id="Context.Abort">func (*Context) <a href="/target/web.go?s=1361:1411#L47">
364380

365381

366382

367-
<h3 id="Context.ContentType">func (*Context) <a href="/target/web.go?s=2224:2267#L72">ContentType</a></h3>
383+
<h3 id="Context.ContentType">func (*Context) <a href="/target/web.go?s=2223:2266#L71">ContentType</a></h3>
368384
<pre>func (ctx *Context) ContentType(ext string)</pre>
369385
<p>
370386
Sets the content type by extension, as defined in the mime package.
@@ -375,14 +391,14 @@ <h3 id="Context.ContentType">func (*Context) <a href="/target/web.go?s=2224:2267
375391

376392

377393

378-
<h3 id="Context.GetSecureCookie">func (*Context) <a href="/target/web.go?s=4255:4318#L134">GetSecureCookie</a></h3>
394+
<h3 id="Context.GetSecureCookie">func (*Context) <a href="/target/web.go?s=4254:4317#L133">GetSecureCookie</a></h3>
379395
<pre>func (ctx *Context) GetSecureCookie(name string) (string, bool)</pre>
380396

381397

382398

383399

384400

385-
<h3 id="Context.NotFound">func (*Context) <a href="/target/web.go?s=1933:1977#L65">NotFound</a></h3>
401+
<h3 id="Context.NotFound">func (*Context) <a href="/target/web.go?s=1932:1976#L64">NotFound</a></h3>
386402
<pre>func (ctx *Context) NotFound(message string)</pre>
387403
<p>
388404
NotFound writes a 404 HTTP response
@@ -392,7 +408,7 @@ <h3 id="Context.NotFound">func (*Context) <a href="/target/web.go?s=1933:1977#L6
392408

393409

394410

395-
<h3 id="Context.NotModified">func (*Context) <a href="/target/web.go?s=1815:1848#L60">NotModified</a></h3>
411+
<h3 id="Context.NotModified">func (*Context) <a href="/target/web.go?s=1814:1847#L59">NotModified</a></h3>
396412
<pre>func (ctx *Context) NotModified()</pre>
397413
<p>
398414
Notmodified writes a 304 HTTP response
@@ -402,7 +418,7 @@ <h3 id="Context.NotModified">func (*Context) <a href="/target/web.go?s=1815:1848
402418

403419

404420

405-
<h3 id="Context.Redirect">func (*Context) <a href="/target/web.go?s=1553:1606#L53">Redirect</a></h3>
421+
<h3 id="Context.Redirect">func (*Context) <a href="/target/web.go?s=1552:1605#L52">Redirect</a></h3>
406422
<pre>func (ctx *Context) Redirect(status int, url_ string)</pre>
407423
<p>
408424
Redirect is a helper method for 3xx redirects.
@@ -412,7 +428,7 @@ <h3 id="Context.Redirect">func (*Context) <a href="/target/web.go?s=1553:1606#L5
412428

413429

414430

415-
<h3 id="Context.SetCookie">func (*Context) <a href="/target/web.go?s=2901:2968#L94">SetCookie</a></h3>
431+
<h3 id="Context.SetCookie">func (*Context) <a href="/target/web.go?s=2900:2967#L93">SetCookie</a></h3>
416432
<pre>func (ctx *Context) SetCookie(name string, value string, age int64)</pre>
417433
<p>
418434
SetCookie sets a cookie header. Duration is specified in seconds. If the duration
@@ -423,7 +439,7 @@ <h3 id="Context.SetCookie">func (*Context) <a href="/target/web.go?s=2901:2968#L
423439

424440

425441

426-
<h3 id="Context.SetHeader">func (*Context) <a href="/target/web.go?s=2602:2668#L84">SetHeader</a></h3>
442+
<h3 id="Context.SetHeader">func (*Context) <a href="/target/web.go?s=2601:2667#L83">SetHeader</a></h3>
427443
<pre>func (ctx *Context) SetHeader(hdr string, val string, unique bool)</pre>
428444
<p>
429445
SetHeader sets a response header. If `unique` is true, the current value
@@ -434,14 +450,14 @@ <h3 id="Context.SetHeader">func (*Context) <a href="/target/web.go?s=2602:2668#L
434450

435451

436452

437-
<h3 id="Context.SetSecureCookie">func (*Context) <a href="/target/web.go?s=3528:3599#L116">SetSecureCookie</a></h3>
453+
<h3 id="Context.SetSecureCookie">func (*Context) <a href="/target/web.go?s=3527:3598#L115">SetSecureCookie</a></h3>
438454
<pre>func (ctx *Context) SetSecureCookie(name string, val string, age int64)</pre>
439455

440456

441457

442458

443459

444-
<h3 id="Context.WriteString">func (*Context) <a href="/target/web.go?s=1035:1082#L39">WriteString</a></h3>
460+
<h3 id="Context.WriteString">func (*Context) <a href="/target/web.go?s=1034:1081#L38">WriteString</a></h3>
445461
<pre>func (ctx *Context) WriteString(content string)</pre>
446462
<p>
447463
WriteString writes string data into the response object.
@@ -453,7 +469,7 @@ <h3 id="Context.WriteString">func (*Context) <a href="/target/web.go?s=1035:1082
453469

454470

455471

456-
<h2 id="ResponseWriter">type <a href="/target/web.go?s=441:581#L20">ResponseWriter</a></h2>
472+
<h2 id="ResponseWriter">type <a href="/target/web.go?s=440:580#L19">ResponseWriter</a></h2>
457473
<pre>type ResponseWriter interface {
458474
Header() http.Header
459475
WriteHeader(status int)
@@ -474,7 +490,7 @@ <h2 id="ResponseWriter">type <a href="/target/web.go?s=441:581#L20">ResponseWrit
474490

475491

476492

477-
<h2 id="Server">type <a href="/target/web.go?s=11378:11566#L390">Server</a></h2>
493+
<h2 id="Server">type <a href="/target/web.go?s=11377:11565#L389">Server</a></h2>
478494
<pre>type Server struct {
479495
Config *ServerConfig
480496

@@ -495,15 +511,15 @@ <h2 id="Server">type <a href="/target/web.go?s=11378:11566#L390">Server</a></h2>
495511

496512

497513

498-
<h3 id="NewServer">func <a href="/target/web.go?s=11568:11592#L399">NewServer</a></h3>
514+
<h3 id="NewServer">func <a href="/target/web.go?s=11567:11591#L398">NewServer</a></h3>
499515
<pre>func NewServer() *Server</pre>
500516

501517

502518

503519

504520

505521

506-
<h3 id="Server.Close">func (*Server) <a href="/target/web.go?s=14048:14072#L489">Close</a></h3>
522+
<h3 id="Server.Close">func (*Server) <a href="/target/web.go?s=14047:14071#L488">Close</a></h3>
507523
<pre>func (s *Server) Close()</pre>
508524
<p>
509525
Close stops server s.
@@ -513,7 +529,7 @@ <h3 id="Server.Close">func (*Server) <a href="/target/web.go?s=14048:14072#L489"
513529

514530

515531

516-
<h3 id="Server.Delete">func (*Server) <a href="/target/web.go?s=14752:14810#L516">Delete</a></h3>
532+
<h3 id="Server.Delete">func (*Server) <a href="/target/web.go?s=14751:14809#L515">Delete</a></h3>
517533
<pre>func (s *Server) Delete(route string, handler interface{})</pre>
518534
<p>
519535
Delete adds a handler for the &#39;DELETE&#39; http method for server s.
@@ -523,7 +539,7 @@ <h3 id="Server.Delete">func (*Server) <a href="/target/web.go?s=14752:14810#L516
523539

524540

525541

526-
<h3 id="Server.Get">func (*Server) <a href="/target/web.go?s=14259:14314#L501">Get</a></h3>
542+
<h3 id="Server.Get">func (*Server) <a href="/target/web.go?s=14258:14313#L500">Get</a></h3>
527543
<pre>func (s *Server) Get(route string, handler interface{})</pre>
528544
<p>
529545
Get adds a handler for the &#39;GET&#39; http method for server s.
@@ -533,7 +549,17 @@ <h3 id="Server.Get">func (*Server) <a href="/target/web.go?s=14259:14314#L501">G
533549

534550

535551

536-
<h3 id="Server.Post">func (*Server) <a href="/target/web.go?s=14422:14478#L506">Post</a></h3>
552+
<h3 id="Server.Match">func (*Server) <a href="/target/web.go?s=14923:14995#L520">Match</a></h3>
553+
<pre>func (s *Server) Match(method string, route string, handler interface{})</pre>
554+
<p>
555+
Match adds a handler for an arbitrary http method for server s.
556+
</p>
557+
558+
559+
560+
561+
562+
<h3 id="Server.Post">func (*Server) <a href="/target/web.go?s=14421:14477#L505">Post</a></h3>
537563
<pre>func (s *Server) Post(route string, handler interface{})</pre>
538564
<p>
539565
Post adds a handler for the &#39;POST&#39; http method for server s.
@@ -543,7 +569,7 @@ <h3 id="Server.Post">func (*Server) <a href="/target/web.go?s=14422:14478#L506">
543569

544570

545571

546-
<h3 id="Server.Put">func (*Server) <a href="/target/web.go?s=14585:14640#L511">Put</a></h3>
572+
<h3 id="Server.Put">func (*Server) <a href="/target/web.go?s=14584:14639#L510">Put</a></h3>
547573
<pre>func (s *Server) Put(route string, handler interface{})</pre>
548574
<p>
549575
Put adds a handler for the &#39;PUT&#39; http method for server s.
@@ -553,7 +579,7 @@ <h3 id="Server.Put">func (*Server) <a href="/target/web.go?s=14585:14640#L511">P
553579

554580

555581

556-
<h3 id="Server.Run">func (*Server) <a href="/target/web.go?s=12012:12045#L418">Run</a></h3>
582+
<h3 id="Server.Run">func (*Server) <a href="/target/web.go?s=12011:12044#L417">Run</a></h3>
557583
<pre>func (s *Server) Run(addr string)</pre>
558584
<p>
559585
Run starts the web application and serves HTTP requests for s
@@ -563,7 +589,7 @@ <h3 id="Server.Run">func (*Server) <a href="/target/web.go?s=12012:12045#L418">R
563589

564590

565591

566-
<h3 id="Server.RunFcgi">func (*Server) <a href="/target/web.go?s=13729:13766#L477">RunFcgi</a></h3>
592+
<h3 id="Server.RunFcgi">func (*Server) <a href="/target/web.go?s=13728:13765#L476">RunFcgi</a></h3>
567593
<pre>func (s *Server) RunFcgi(addr string)</pre>
568594
<p>
569595
RunFcgi starts the web application and serves FastCGI requests for s.
@@ -573,7 +599,7 @@ <h3 id="Server.RunFcgi">func (*Server) <a href="/target/web.go?s=13729:13766#L47
573599

574600

575601

576-
<h3 id="Server.RunScgi">func (*Server) <a href="/target/web.go?s=13365:13402#L465">RunScgi</a></h3>
602+
<h3 id="Server.RunScgi">func (*Server) <a href="/target/web.go?s=13364:13401#L464">RunScgi</a></h3>
577603
<pre>func (s *Server) RunScgi(addr string)</pre>
578604
<p>
579605
RunScgi starts the web application and serves SCGI requests for s.
@@ -583,7 +609,7 @@ <h3 id="Server.RunScgi">func (*Server) <a href="/target/web.go?s=13365:13402#L46
583609

584610

585611

586-
<h3 id="Server.RunTLS">func (*Server) <a href="/target/web.go?s=12815:12877#L445">RunTLS</a></h3>
612+
<h3 id="Server.RunTLS">func (*Server) <a href="/target/web.go?s=12814:12876#L444">RunTLS</a></h3>
587613
<pre>func (s *Server) RunTLS(addr string, config *tls.Config) error</pre>
588614
<p>
589615
RunTLS starts the web application and serves HTTPS requests for s.
@@ -593,14 +619,14 @@ <h3 id="Server.RunTLS">func (*Server) <a href="/target/web.go?s=12815:12877#L445
593619

594620

595621

596-
<h3 id="Server.ServeHTTP">func (*Server) <a href="/target/web.go?s=6530:6598#L228">ServeHTTP</a></h3>
622+
<h3 id="Server.ServeHTTP">func (*Server) <a href="/target/web.go?s=6529:6597#L227">ServeHTTP</a></h3>
597623
<pre>func (s *Server) ServeHTTP(c http.ResponseWriter, req *http.Request)</pre>
598624

599625

600626

601627

602628

603-
<h3 id="Server.SetLogger">func (*Server) <a href="/target/web.go?s=15559:15605#L541">SetLogger</a></h3>
629+
<h3 id="Server.SetLogger">func (*Server) <a href="/target/web.go?s=15929:15975#L550">SetLogger</a></h3>
604630
<pre>func (s *Server) SetLogger(logger *log.Logger)</pre>
605631
<p>
606632
SetLogger sets the logger for server s
@@ -612,7 +638,7 @@ <h3 id="Server.SetLogger">func (*Server) <a href="/target/web.go?s=15559:15605#L
612638

613639

614640

615-
<h2 id="ServerConfig">type <a href="/target/web.go?s=11194:11337#L381">ServerConfig</a></h2>
641+
<h2 id="ServerConfig">type <a href="/target/web.go?s=11193:11336#L380">ServerConfig</a></h2>
616642
<pre>type ServerConfig struct {
617643
StaticDir string
618644
Addr string

0 commit comments

Comments
 (0)