-
Notifications
You must be signed in to change notification settings - Fork 73
/
main.go
36 lines (27 loc) · 838 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
36
package main
import (
"net/http"
controller "github.com/jeffthorne/tasky/controllers"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)
func index(c *gin.Context) {
c.HTML(http.StatusOK, "login.html", nil)
}
func main() {
godotenv.Overload()
router := gin.Default()
router.LoadHTMLGlob("assets/*.html")
router.Static("/assets", "./assets")
router.GET("/", index)
router.GET("/todos/:userid", controller.GetTodos)
router.GET("/todo/:id", controller.GetTodo)
router.POST("/todo/:userid", controller.AddTodo)
router.DELETE("/todo/:userid/:id", controller.DeleteTodo)
router.DELETE("/todos/:userid", controller.ClearAll)
router.PUT("/todo", controller.UpdateTodo)
router.POST("/signup", controller.SignUp)
router.POST("/login", controller.Login)
router.GET("/todo", controller.Todo)
router.Run(":8080" )
}