some progress on static files
This commit is contained in:
parent
58ea9ce258
commit
3ab1affc1c
3
README
3
README
@ -75,7 +75,6 @@ custom error pages
|
|||||||
* web app
|
* web app
|
||||||
* accessing header values and query params
|
* accessing header values and query params
|
||||||
* accessing post body
|
* accessing post body
|
||||||
* serve static files http://code.google.com/p/go-wiki/wiki/HttpStaticFiles
|
|
||||||
* simultaneous assignment
|
* simultaneous assignment
|
||||||
* mongo
|
* mongo
|
||||||
* time formatting
|
* time formatting
|
||||||
@ -84,6 +83,8 @@ custom error pages
|
|||||||
* set library
|
* set library
|
||||||
* base64 encoding
|
* base64 encoding
|
||||||
* http streaming server
|
* http streaming server
|
||||||
|
* inline panic
|
||||||
|
|
||||||
* http streaming client
|
* http streaming client
|
||||||
* templating
|
* templating
|
||||||
* ssh
|
* ssh
|
||||||
|
19
src/xx-http-server-static.go
Normal file
19
src/xx-http-server-static.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
handler := http.FileServer(http.Dir("./"))
|
||||||
|
http.ListenAndServe(":5000", handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// == running
|
||||||
|
// $ cd src
|
||||||
|
// $ go run xx-http-server-static.go
|
||||||
|
//
|
||||||
|
// $ curl http://127.0.0.1:5000/
|
||||||
|
// $ curl http://127.0.0.1:5000/xx-http-server-static.go
|
||||||
|
// $ curl http://127.0.0.1:5000/missing
|
||||||
|
|
||||||
|
// == todo
|
||||||
|
// serving only a subpath as statically
|
Loading…
x
Reference in New Issue
Block a user