initial refactor in go
This commit is contained in:
27
main.go
Normal file
27
main.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"acooldomain.co/backend/dbhandler"
|
||||
"acooldomain.co/backend/users"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
router := gin.Default()
|
||||
|
||||
client, err := dbhandler.Connect("mongodb://localhost:27017")
|
||||
defer func() {
|
||||
if err = client.Disconnect(context.TODO()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
users.LoadGroup(router.Group("/users"), client)
|
||||
|
||||
router.Run("localhost:8080")
|
||||
}
|
||||
Reference in New Issue
Block a user