moved api to golang and dashboard do nodejs
This commit is contained in:
29
AuthentesBackend/controllers/game.go
Normal file
29
AuthentesBackend/controllers/game.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
func GetGames(db *mongo.Database){
|
||||
coll := db.Collection("Games")
|
||||
|
||||
var result bson.M
|
||||
cur, err := coll.Find(context.TODO(), bson.D{{}})
|
||||
|
||||
if err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
// This error means your query did not match any documents.
|
||||
return
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(cur)
|
||||
fmt.Println(result)
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user