Dieses Repository enthält die Code-Beispiele zum Buch RESTful Go APIs von Ralf Wirdemann.
cd $GOPATH/src
git clone https://github.com/rwirdemann/restvoice.git
go get github.com/gorilla/mux
Dieses Repository enthält die Code-Beispiele zum Buch RESTful Go APIs von Ralf Wirdemann.
cd $GOPATH/src
git clone https://github.com/rwirdemann/restvoice.git
go get github.com/gorilla/mux
In kapitel05/main.go
accept := request.Header.Get("Accept")
switch accept {
case "application/pdf":
content := bytes.NewReader(i.ToPDF())
http.ServeContent(writer, request, "invoice.pdf", time.Now(), content)
case "application/json":
b, _ := json.Marshal(i)
writer.Header().Set("Content-Type", "application/json")
_, _ = writer.Write(b)
default:
writer.WriteHeader(http.StatusNotAcceptable)
}
If the client sends multiple values curl -i http://localhost:8080/customers/1/invoices/1 \ -H 'Accept: application/pdf, application/json'
then the switch will always hit the default case.
Value of accept is application/pdf, application/json
and does not match any case.
I thought I'd mention it as the book states that query on page 65
The code smells mentioned in the book on page 84 are not addressed in chapter 7.
Should the aggregation block be refactored into a separate function on the usecase or the invoice domain? What is your take on that?
go get github.com/gorilla/mux produziert einen Fehler.
mit go get -u github.com/gorilla/mux funktioniert es einwandfrei
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.