mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-07-20 07:02:53 +02:00
initial import
This commit is contained in:
5
microservices/rfc7808/server/go.mod
Normal file
5
microservices/rfc7808/server/go.mod
Normal file
@ -0,0 +1,5 @@
|
||||
module golang.source-fellows.com/samples/rfc7808/server
|
||||
|
||||
go 1.13
|
||||
|
||||
require github.com/moogar0880/problems v0.1.1 // indirect
|
2
microservices/rfc7808/server/go.sum
Normal file
2
microservices/rfc7808/server/go.sum
Normal file
@ -0,0 +1,2 @@
|
||||
github.com/moogar0880/problems v0.1.1 h1:bktLhq8NDG/czU2ZziYNigBFksx13RaYe5AVdNmHDT4=
|
||||
github.com/moogar0880/problems v0.1.1/go.mod h1:5Dxrk2sD7BfBAgnOzQ1yaTiuCYdGPUh49L8Vhfky62c=
|
22
microservices/rfc7808/server/main.go
Normal file
22
microservices/rfc7808/server/main.go
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/moogar0880/problems"
|
||||
)
|
||||
|
||||
func handleHttp(res http.ResponseWriter, req *http.Request) {
|
||||
NotFound := problems.NewStatusProblem(http.StatusNotFound)
|
||||
bites, _ := json.Marshal(NotFound)
|
||||
res.WriteHeader(http.StatusNotFound)
|
||||
res.Header().Add("Content-Type", "application/json")
|
||||
res.Write(bites)
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/a/", handleHttp)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
Reference in New Issue
Block a user