first commit
This commit is contained in:
22
server/controllers/users.go
Normal file
22
server/controllers/users.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/akhilrex/hammond/db"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterUserController(router *gin.RouterGroup) {
|
||||
router.GET("/users", allUsers)
|
||||
}
|
||||
|
||||
func allUsers(c *gin.Context) {
|
||||
users, err := db.GetAllUsers()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, users)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user