Skip to content

Commit

Permalink
add simple http server, a Makefile and update the README.md file
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <[email protected]>
  • Loading branch information
glours committed Jun 21, 2021
1 parent 24414f6 commit 61aa8f8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY: build
build:
mkdir -p bin
go build -trimpath -o bin/single-dev-env

.PHONY: run
run:
go run main.go
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# single-dev-env
Example used to try a single container sample of Docker Dev Environments

## Run the application
You can simply use `make run` command or do it yourself with `go run main.go`

Those commands will start a http server listening on port `8080`
and if your request `http://localhost:8080` you'll see the following output:
```shell
❯ curl http://localhost:8080

## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
{ / ===-
\______ O __/
\ \ __/
\____\_______/
Hello from Docker!
```
31 changes: 31 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"fmt"
"log"
"net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
fmt.Println(r.URL.RawQuery)
fmt.Fprintf(w, `
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
{ / ===-
\______ O __/
\ \ __/
\____\_______/
Hello from Docker!
`)
}

func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}

0 comments on commit 61aa8f8

Please sign in to comment.