PracowniaProgramowania/backend/main.go

36 lines
963 B
Go
Raw Normal View History

2018-11-18 23:42:18 +01:00
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
2019-01-09 07:26:21 +01:00
api.POST("/addNewCardView", addNewCardView) // [couchdb] dodawanie nowej karty
2018-11-18 23:42:18 +01:00
// Start and run the server
router.Run(":3000")
}