-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simple http server, a Makefile and update the README.md file
Signed-off-by: Guillaume Lours <[email protected]>
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} | ||
|