PracowniaProgramowania/backend/main.go

39 lines
1.0 KiB
Go

package main
//Uruchomienie na windowsie
// go run main.go connector_couchdb.go connector_mysql.go models.go views.go
import (
"net/http"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
)
func main() {
// Set the router as the default one shipped with Gin
router := gin.Default()
// Serve frontend static files
router.Use(static.Serve("/", static.LocalFile("./views", true)))
// Setup route group for the API
api := router.Group("/api")
{
api.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
}
api.GET("/getUsersView", getUsersView) //widok pobrania wszystkich użytkowników
api.POST("/addNewUserView", addNewUserView) // json z danymi nowego uzytkownika
api.POST("/loginUserView", loginUserView) //logowanie
api.POST("/updateUserPointsView", updateUserPointsView) // inkrementacja punktow
api.POST("/addNewCardView", addNewCardView) // [couchdb] dodawanie nowej karty
// Start and run the server
router.Run(":3000")
}