Skip to content

Commit da48919

Browse files
config
1 parent b6552a7 commit da48919

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mongoconnect/config.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,27 @@ func Insertdata(client *mongo.Client, ctx context.Context, dataBase, col string,
8080
// and of empty interface
8181
result, err := collection.InsertOne(ctx, doc)
8282
return result, err
83+
}
84+
85+
type marks struct {
86+
rollNo int `json:"rollno"`
87+
maths int `json:"maths"`
88+
science int `json:"science"`
89+
computer int `json:"computer"`
90+
}
91+
92+
// for testing added
93+
94+
func PostMarks(c *gin.Context) {
95+
var newMarks marks
96+
97+
// Call BindJSON to bind the received JSON to
98+
// newAlbum.
99+
if err := c.BindJSON(&newMarks); err != nil {
100+
return
101+
}
102+
103+
// Add the new album to the slice.
104+
albums = append(albums, newMarks)
105+
c.IndentedJSON(http.StatusCreated, newMarks)
83106
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy