Fix section "Beego static files and settings" in 14.1.md
This commit is contained in:
10
en/14.1.md
10
en/14.1.md
@@ -2,9 +2,9 @@
|
||||
|
||||
We've already talked about how to deal with static files in previous sections. Now, let's look at how to set up and use static files inside of Beego. Then, through introducing Twitter's open source HTML and CSS framework Bootstrap, we'll be able quickly create beautiful looking websites without having to do much design work.o
|
||||
|
||||
## Beego static files and settings to achieve
|
||||
## Beego static files and settings
|
||||
|
||||
Go's net/ http package provides a static file serving, `ServeFile` and `FileServer` other functions. beego static file processing is handled based on this layer, the specific implementation is as follows:
|
||||
Go's `net/http` package provides a static file server with functions such as `ServeFile` and `FileServer`. Beego's static file handling is based on this layer, and its specific implementation is as follow:
|
||||
|
||||
//static file server
|
||||
for prefix, staticDir := range StaticDir {
|
||||
@@ -16,13 +16,13 @@ Go's net/ http package provides a static file serving, `ServeFile` and `FileServ
|
||||
}
|
||||
}
|
||||
|
||||
StaticDir is stored inside the corresponding URL corresponds to a static file directory, so handle URL requests when the request need only determine whether the address corresponding to the beginning of the process contains static URL, if included on the use http.ServeFile provide services.
|
||||
`StaticDir` stores the URL which corresponds to a static file directory, so when handling requests, we simply need to determine whether or not the URL begins with a static file path. If so, we can simply respond using `http.ServeFile`.
|
||||
|
||||
Examples are as follows:
|
||||
The following is an example:
|
||||
|
||||
beego.StaticDir["/asset"] = "/static"
|
||||
|
||||
Example. Then the request url `http://www.beego.me/asset/bootstrap.css` will request `/static/bootstrap.css` for the client.
|
||||
Then, a request with a URL such as `http://www.beego.me/asset/bootstrap.css` will result in `/static/bootstrap.css` being served to the client.
|
||||
|
||||
## Bootstrap integration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user