File tree 4 files changed +22
-2
lines changed
4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change
1
+ S3_BUCKET = YOURS3BUCKET
2
+ SECRET_KEY = YOURSECRETKEYGOESHERE
3
+ PORT = 3001
Original file line number Diff line number Diff line change 1
1
module github.com/vinodnextcoder/go-web-app
2
2
3
- go 1.20
3
+ go 1.21
4
+
5
+ toolchain go1.21.5
4
6
5
7
require (
6
8
github.com/KyleBanks/depth v1.2.1 // indirect
@@ -20,6 +22,7 @@ require (
20
22
github.com/go-playground/universal-translator v0.18.1 // indirect
21
23
github.com/go-playground/validator/v10 v10.17.0 // indirect
22
24
github.com/goccy/go-json v0.10.2 // indirect
25
+ github.com/joho/godotenv v1.5.1 // indirect
23
26
github.com/josharian/intern v1.0.0 // indirect
24
27
github.com/json-iterator/go v1.1.12 // indirect
25
28
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG
42
42
github.com/golang/protobuf v1.5.0 /go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk =
43
43
github.com/google/go-cmp v0.5.5 /go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE =
44
44
github.com/google/gofuzz v1.0.0 /go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg =
45
+ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0 =
46
+ github.com/joho/godotenv v1.5.1 /go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4 =
45
47
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY =
46
48
github.com/josharian/intern v1.0.0 /go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y =
47
49
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM =
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "fmt"
5
+ "log"
4
6
"net/http"
7
+ "os"
5
8
9
+ "github.com/joho/godotenv"
6
10
"github.com/gin-gonic/gin"
7
11
swaggerFiles "github.com/swaggo/files"
8
12
ginSwagger "github.com/swaggo/gin-swagger"
@@ -24,6 +28,14 @@ import (
24
28
// @externalDocs.url https://swagger.io/resources/open-api/
25
29
func main () {
26
30
31
+ err := godotenv .Load (".env.dev" )
32
+
33
+ if err != nil {
34
+ log .Fatal ("Error loading .env file" )
35
+ }
36
+
37
+ port := os .Getenv ("PORT" )
38
+
27
39
router := gin .Default ()
28
40
29
41
router .GET ("/" , helloCall )
@@ -35,7 +47,7 @@ func main() {
35
47
router .GET ("/userData/:id" , getUserByID )
36
48
router .GET ("/swagger/*any" , ginSwagger .WrapHandler (swaggerFiles .Handler ))
37
49
38
- router .Run (":3001" )
50
+ router .Run ("0.0.0.0:" + port )
39
51
}
40
52
41
53
type userDetail struct {
You can’t perform that action at this time.
0 commit comments