Skip to content

Commit 43b4839

Browse files
author
Stephen Hinett
committed
update: contains a bunch of new files and folders that will be used
later on - Added editorconfig just for the current yml files - Got docker-compose up and running for the backend api printing Hello, Something on the 9000 port - Added Go air to recompile the app once Go changes have been spotted
1 parent 14795ad commit 43b4839

File tree

8 files changed

+64
-0
lines changed

8 files changed

+64
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# EditorConfig is awesome: https://EditorConfig.org
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Unix-style newlines with a newline ending every file
8+
[*]
9+
end_of_line = lf
10+
insert_final_newline = true
11+
12+
# Tab indentation (no size specified)
13+
[Makefile]
14+
indent_style = tab
15+
16+
# Matches the exact files either package.json or .travis.yml
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2

backend/docker-compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
api:
3+
build:
4+
context: ./docker
5+
dockerfile: Dockerfile.dev
6+
ports:
7+
- "9000:9000"
8+
volumes:
9+
- ./:/api
10+
command: [ "air" ]

backend/docker/Dockerfile.dev

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM golang:1.18.2-alpine
2+
3+
# Working directory
4+
WORKDIR /api
5+
6+
COPY ./go.mod .
7+
COPY . .
8+
9+
RUN apk update && apk add --no-cache git
10+
11+
# Go envs
12+
ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0
13+
14+
RUN go mod download && go mod verify
15+
16+
# Live reload for Go
17+
RUN go install github.com/cosmtrek/air@latest
18+
19+
EXPOSE 9000

backend/main.go

+16
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
package main
2+
3+
import (
4+
"log"
5+
"net/http"
6+
)
7+
8+
func main() {
9+
mux := http.NewServeMux()
10+
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
11+
w.Write([]byte("Hello, Something!"))
12+
})
13+
14+
log.Println("Starting server on :9000")
15+
err := http.ListenAndServe(":9000", mux)
16+
log.Fatal(err)
17+
}

backend/tmp/main

5.95 MB
Binary file not shown.

docker/backend/.gitkeep

Whitespace-only changes.

docker/frontend/.gitkeep

Whitespace-only changes.

docker/nginx/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)