PracowniaProgramowania/backend/main.go
2019-01-09 07:26:21 +01:00

36 lines
963 B
Go

package main
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")
}