|
1 年之前 | |
---|---|---|
.. | ||
log | 1 年之前 | |
.gitignore | 1 年之前 | |
.goconvey | 1 年之前 | |
.travis.yml | 1 年之前 | |
CHANGES.md | 1 年之前 | |
LICENSE | 1 年之前 | |
Makefile | 1 年之前 | |
README.md | 1 年之前 | |
SECURITY.md | 1 年之前 | |
Srcfile | 1 年之前 | |
bench_test.sh | 1 年之前 | |
compress.go | 1 年之前 | |
compressor_cache.go | 1 年之前 | |
compressor_pools.go | 1 年之前 | |
compressors.go | 1 年之前 | |
constants.go | 1 年之前 | |
container.go | 1 年之前 | |
cors_filter.go | 1 年之前 | |
coverage.sh | 1 年之前 | |
curly.go | 1 年之前 | |
curly_route.go | 1 年之前 | |
custom_verb.go | 1 年之前 | |
doc.go | 1 年之前 | |
entity_accessors.go | 1 年之前 | |
extensions.go | 1 年之前 | |
filter.go | 1 年之前 | |
filter_adapter.go | 1 年之前 | |
json.go | 1 年之前 | |
jsoniter.go | 1 年之前 | |
jsr311.go | 1 年之前 | |
logger.go | 1 年之前 | |
mime.go | 1 年之前 | |
options_filter.go | 1 年之前 | |
parameter.go | 1 年之前 | |
path_expression.go | 1 年之前 | |
path_processor.go | 1 年之前 | |
request.go | 1 年之前 | |
response.go | 1 年之前 | |
route.go | 1 年之前 | |
route_builder.go | 1 年之前 | |
route_reader.go | 1 年之前 | |
router.go | 1 年之前 | |
service_error.go | 1 年之前 | |
web_service.go | 1 年之前 | |
web_service_container.go | 1 年之前 |
package for building REST-style Web Services using Google Go
REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping:
All versions up to v2.*.*
(on the master) are not supporting Go modules.
import (
restful "github.com/emicklei/go-restful"
)
As of version v3.0.0
(on the v3 branch), this package supports Go modules.
import (
restful "github.com/emicklei/go-restful/v3"
)
ws := new(restful.WebService)
ws.
Path("/users").
Consumes(restful.MIME_XML, restful.MIME_JSON).
Produces(restful.MIME_JSON, restful.MIME_XML)
ws.Route(ws.GET("/{user-id}").To(u.findUser).
Doc("get a user").
Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")).
Writes(User{}))
...
func (u UserResource) findUser(request *restful.Request, response *restful.Response) {
id := request.PathParameter("user-id")
...
}
HttpMiddlewareHandlerToFilter
functionThere are several hooks to customize the behavior of the go-restful package.
go build -tags=jsoniter .
Type git shortlog -s
for a full list of contributors.
© 2012 - 2022, http://ernestmicklei.com. MIT License. Contributions are welcome.