about summary refs log tree commit diff
path: root/eg/base.go
diff options
context:
space:
mode:
authorFranck Cuny <franck@lumberjaph.net>2013-05-08 21:25:30 -0700
committerFranck Cuny <franck@lumberjaph.net>2013-05-08 21:25:30 -0700
commit06f8463d80d9795baf0008f4b71d7b108965db1b (patch)
tree734539fc0713400a5332ea5f3fa76f8e91bac88a /eg/base.go
parentrequest and response are in web-request (diff)
downloadpath-router-06f8463d80d9795baf0008f4b71d7b108965db1b.tar.gz
remove the example, it does not make sense anymore
Diffstat (limited to '')
-rw-r--r--eg/base.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/eg/base.go b/eg/base.go
deleted file mode 100644
index fdf2810..0000000
--- a/eg/base.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package main
-
-import (
-	"github.com/franckcuny/path-router"
-	"github.com/franckcuny/web-request"
-	"net/http"
-)
-
-func TestId(req *request.Request) (request.Response, error) {
-	r := request.Response{
-		Status:  200,
-		Content: "id",
-	}
-	return r, nil
-}
-
-func TestIdFoo(req *request.Request) (request.Response, error) {
-	r := request.Response{
-		Status:  200,
-		Content: "foo",
-	}
-	return r, nil
-}
-
-func Test(req *request.Request) (request.Response, error) {
-	resp := request.Response{}
-	resp.Status = 200
-	resp.Content = "duh"
-	return resp, nil
-}
-
-func TestPut(req *request.Request) (request.Response, error) {
-	resp := request.Response{}
-	resp.Status = 200
-	resp.Content = "ok"
-	return resp, nil
-}
-
-func main() {
-	router := router.BuildRouter()
-
-	router.AddRoute(
-		&router.Route{
-			Method: "GET",
-			Path:   "/foo/bar/baz",
-			Code:   Test,
-		},
-	)
-	router.AddRoute(
-		&router.Route{
-			Method: "PUT",
-			Path:   "/foo/bar/baz",
-			Code:   TestPut,
-		},
-	)
-	router.AddRoute(
-		&router.Route{
-			Method: "GET",
-			Path:   "/test/{id}",
-			Code:   TestId,
-		},
-	)
-	router.AddRoute(
-		&router.Route{
-			Method: "GET",
-			Path:   "/test/{id}/foo",
-			Code:   TestIdFoo,
-		},
-	)
-
-	http.ListenAndServe(":8080", &router)
-}