File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1
1
# go-mongo-server
2
2
Connect Go driver with MongoDB
3
+
4
+ ## Writing a basic HTTP server is easy using Gin package mongo connect
5
+
6
+ # To run http server
7
+
8
+
9
+ ```
10
+ for gin
11
+
12
+ git clone https://github.com/vinodnextcoder/go-mongo-server.git
13
+ you go directory install package and run code
14
+
15
+ cd go-mongo-server
16
+
17
+ Install Gin:
18
+ go get github.com/gin-gonic/gin
19
+ go get go.mongodb.org/mongo-driver/mongo
20
+ go get github.com/joho/godotenv
21
+ go get github.com/swaggo/files
22
+ go get github.com/swaggo/gin-swagger
23
+ go install github.com/swaggo/swag/cmd/swag@latest
24
+ swag init
25
+
26
+ You can run your Gin web application by executing the main.go file:
27
+
28
+ go run main.go
29
+
30
+ ````
31
+ # to call api endpoint in postman
32
+
33
+ ```
34
+ http://localhost:3000
35
+
36
+ ```
37
+
38
+ # You can go to swagger doc
39
+
40
+ ```
41
+ http://localhost:3001/swagger/index.html
42
+ ```
43
+
You can’t perform that action at this time.
0 commit comments