PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/src/test/TestMod.fan

https://bitbucket.org/afrankvt/draft/
Unknown | 53 lines | 46 code | 7 blank | 0 comment | 0 complexity | 3be6985e15c8dc0a4da2a6cc46cc23f8 MD5 | raw file
 1//
 2// Copyright (c) 2011, Andy Frank
 3// Licensed under the MIT License
 4//
 5// History:
 6//   16 May 2011  Andy Frank  Creation
 7//
 8
 9using util
10using web
11using wisp
12
13**
14** TestMod
15**
16internal const class TestMod : DraftMod
17{
18  ** Constructor.
19  new make()
20  {
21    router = Router {
22      routes = [
23        Route("/foo",      "GET", #foo),
24        Route("/foo/bar",  "GET", #fooBar),
25        Route("/foo/{id}", "GET", #fooId),
26      ]
27    }
28  }
29
30  ** Foo handler
31  Void foo() { dump }
32
33  ** FooBar handler
34  Void fooBar() { dump }
35
36  ** Foo {id} handler
37  Void fooId() { dump }
38
39  Void dump()
40  {
41    /*
42    res.headers["Content-Type"] = "text/plain"
43    res.out.w(
44      "=== Testing ===
45        uri:     $req.uri
46        pattern: $match.route.pattern
47        method:  $match.route.handler
48        args:    $match.args")
49    res.out.flush
50    */
51  }
52}
53