Skip to content

Commit

Permalink
04-Macaron
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Nov 2, 2014
1 parent f4ede62 commit ea3aa96
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lectures/04-macaron/class1/sample/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 代码使用说明

### 本文件夹内的代码隶属于 [Macaron - 课时 1:初识 Macaron](https://github.com/Unknwon/go-rock-libraries-showcases/tree/master/lectures/03-goconvey#%E8%AF%BE%E6%97%B6-1%E4%BC%98%E9%9B%85%E7%9A%84%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95) 请注意配套使用
### 本文件夹内的代码隶属于 [Macaron - 课时 1:初识 Macaron](https://github.com/Unknwon/go-rock-libraries-showcases/tree/master/lectures/04-macaron#%E8%AF%BE%E6%97%B6-1%E5%88%9D%E8%AF%86-macaron) 请注意配套使用

## 展示内容

Expand Down
11 changes: 11 additions & 0 deletions lectures/04-macaron/class1/sample/main1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import "github.com/Unknwon/macaron"

func main() {
m := macaron.Classic()
m.Get("/", func() string {
return "Hello world!"
})
m.Run()
}
20 changes: 20 additions & 0 deletions lectures/04-macaron/class1/sample/main2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"log"
"net/http"

"github.com/Unknwon/macaron"
)

func main() {
m := macaron.Classic()
m.Get("/", myHandler)

log.Println("Server is running...")
log.Println(http.ListenAndServe("0.0.0.0:4000", m))
}

func myHandler(ctx *macaron.Context) string {
return "the request path is: " + ctx.Req.RequestURI
}

0 comments on commit ea3aa96

Please sign in to comment.