Update 13.2.md
typographical errors and improved readability
This commit is contained in:
@@ -56,7 +56,7 @@ The Beego framework's router is designed to overcome these limitations, taking t
|
||||
|
||||
### Storing routes
|
||||
|
||||
To address the first limitation of the default router, we need to be able to support dynamic URL parameters. For the second and third points, we adopt an alternative approach,mapping REST methods to struct methods and routing requests to this struct instead handler functions. This way, a forwarded request can be handled according to their HTTP method.
|
||||
To address the first limitation of the default router, we need to be able to support dynamic URL parameters. For the second and third points, we adopt an alternative approach,mapping REST methods to struct methods and routing requests to this struct instead of to handler functions. This way, a forwarded request can be handled according to it's HTTP method.
|
||||
|
||||
Based on the above ideas, we've designed two data types: `controllerInfo`, which saves the path and the corresponding `controllerType` struct as a `reflect.Type` type, and `ControllerRegistor`, which saves routing information for the specified Beego application.
|
||||
|
||||
@@ -124,7 +124,7 @@ Its detailed implementation is as follows:
|
||||
|
||||
### Static routing
|
||||
|
||||
We've implemented dynamic routing in our example above. By default, Go's `http` package supports serving static files with `http.FileServer`, which return a `Handler`. Since we have implemented a custom router, we will also need a way of handling static files. Beego's static folder path is saved in a global variable called `StaticDir`, which maps URL to corresponding paths. The `SetStaticPath`'s implementation can be seen below:
|
||||
We've implemented dynamic routing in our example above. By default, Go's `http` package supports serving static files with `http.FileServer`, which returns a `Handler`. Since we have implemented a custom router, we will also need a way of handling static files. Beego's static folder path is saved in a global variable called `StaticDir`, which maps the URL to corresponding paths. The `SetStaticPath`'s implementation can be seen below:
|
||||
|
||||
func (app *App) SetStaticPath(url string, path string) *App {
|
||||
StaticDir[url] = path
|
||||
|
||||
Reference in New Issue
Block a user