PageRenderTime 257ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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. using util
  9. using web
  10. using wisp
  11. **
  12. ** TestMod
  13. **
  14. internal const class TestMod : DraftMod
  15. {
  16. ** Constructor.
  17. new make()
  18. {
  19. router = Router {
  20. routes = [
  21. Route("/foo", "GET", #foo),
  22. Route("/foo/bar", "GET", #fooBar),
  23. Route("/foo/{id}", "GET", #fooId),
  24. ]
  25. }
  26. }
  27. ** Foo handler
  28. Void foo() { dump }
  29. ** FooBar handler
  30. Void fooBar() { dump }
  31. ** Foo {id} handler
  32. Void fooId() { dump }
  33. Void dump()
  34. {
  35. /*
  36. res.headers["Content-Type"] = "text/plain"
  37. res.out.w(
  38. "=== Testing ===
  39. uri: $req.uri
  40. pattern: $match.route.pattern
  41. method: $match.route.handler
  42. args: $match.args")
  43. res.out.flush
  44. */
  45. }
  46. }