-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (27 loc) · 704 Bytes
/
Copy pathmain.go
File metadata and controls
35 lines (27 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"net/http"
"net"
"log"
)
type SimpleHTTPHandler struct{}
func (*SimpleHTTPHandler) ServeHTTP(httpWriter http.ResponseWriter, httpRequest *http.Request) {
fmt.Fprintf(httpWriter, "Greetings CodeDeploy :), path: %s", httpRequest.URL.Path[1:])
log.Print("serving")
}
/**
* Simple port 1234 server to allow demonstration of minimal CodeBuild/CodePipeline
* CI deployment
*/
func main() {
server := &http.Server{Handler: &SimpleHTTPHandler{}}
listener, error := net.Listen("tcp4", ":1234")
if error != nil {
log.Fatal(error)
}
error = server.Serve(listener)
if error != nil {
log.Fatal(error)
}
}