2015-11-13 17:04:42 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the main file for the Task application
|
|
|
|
* License: MIT
|
|
|
|
**/
|
|
|
|
import (
|
2015-11-21 15:58:23 +08:00
|
|
|
"github.com/thewhitetulip/Tasks/views"
|
2015-11-13 17:04:42 +08:00
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2015-11-21 15:58:23 +08:00
|
|
|
views.PopulateTemplates()
|
|
|
|
http.HandleFunc("/", views.ShowAllTasksFunc)
|
|
|
|
http.HandleFunc("/complete/", views.CompleteTaskFunc)
|
|
|
|
http.HandleFunc("/delete/", views.DeleteTaskFunc)
|
|
|
|
http.HandleFunc("/deleted/", views.ShowTrashTaskFunc)
|
|
|
|
http.HandleFunc("/trash/", views.TrashTaskFunc)
|
|
|
|
http.HandleFunc("/edit/", views.EditTaskFunc)
|
|
|
|
http.HandleFunc("/completed/", views.ShowCompleteTasksFunc)
|
|
|
|
http.HandleFunc("/restore/", views.RestoreTaskFunc)
|
2016-01-09 13:03:35 +08:00
|
|
|
http.HandleFunc("/incomplete/", views.RestoreFromCompleteFunc)
|
2015-11-21 15:58:23 +08:00
|
|
|
http.HandleFunc("/add/", views.AddTaskFunc)
|
|
|
|
http.HandleFunc("/update/", views.UpdateTaskFunc)
|
|
|
|
http.HandleFunc("/search/", views.SearchTaskFunc)
|
2015-11-21 14:39:06 +08:00
|
|
|
//http.HandleFunc("/static/", ServeStaticFunc)
|
|
|
|
http.Handle("/static/", http.FileServer(http.Dir("public")))
|
2016-01-09 13:18:11 +08:00
|
|
|
log.Println("running server on 8080")
|
2015-11-21 14:39:06 +08:00
|
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
2015-11-13 17:04:42 +08:00
|
|
|
}
|