-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (26 loc) · 774 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/gin-gonic/gin"
"reviewtest/controller"
)
func v1Routes(r *gin.RouterGroup) {
r.GET("/ping", controllers.PingV1)
r.POST("/validate", controllers.ValidatePasswordV1)
r.GET("/hash", controllers.GetHashV1)
}
func defaultResponse(c *gin.Context) {
defaultJSON := gin.H{
"task1": "Create an endpoint which returns a 200 response with \"pong\" as response.",
"task2": "Create an endpoint which takes a password as input and return the strenth of password.",
"task3": "Create an endpoint which returns MD5 Hash of any input which is passed.",
}
c.JSON(200, defaultJSON)
}
func main() {
r := gin.Default()
r.GET("/", defaultResponse)
apiV1 := r.Group("api/v1")
v1Routes(apiV1)
// RUNNING ON DEFAULT PORT 8080
r.Run()
}