
HTML, CSS, Javascript 코드를 모두 확인할 수 있으며, 목적은 Go 언어로 서버를 구현하는 것이기 때문에 코드 이해만 하고 코드를 복사하여 public 폴더에 todo.html / todo.css / todo.js 이름으로 저장하였다.
또한 기본 셋팅을 위하여 main.go 파일을 만들고, 라우팅에 따른 핸들러를 분리하여 코드를 작성하기 위해 app 폴더를 생성한 뒤 app.go 파일도 추가했다.

// app/app.go
package app
import (
"net/http"
"github.com/gorilla/mux"
)
func MakeHandler() http.Handler {
router := mux.NewRouter()
return router
}
// main.go
package main
import (
"net/http"
"todolist/app"
"github.com/urfave/negroni"
)
func main() {
mux := app.MakeHandler()
n := negroni.Classic()
n.UseHandler(mux)
http.ListenAndServe(":3000", n)
}

package app
import (
"net/http"
"github.com/gorilla/mux"
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/todo.html", http.StatusTemporaryRedirect)
}
func MakeHandler() http.Handler {
router := mux.NewRouter()
router.HandleFunc("/", indexHandler)
return router
}
MakeHandler() 는 새로운 라우터를 생성하고, 라우터는 “/” 엔드포인트로 요청이 들어오면 indexHandler 를 실행한다.
indexHandler 는 http.Redirect 실행하여 /todo.html 로 리다이렉션 시킨다.
또한 할일목록에 대한 자료를 저장하는 Todo 구조체를 정의했다.