package main
import (
"database/sql"
"net/http"
)
func main() {
db, err := sql.Open("postgres", "")
if err != nil {
panic(err)
}
defer db.Close()
http.Handle("/student", &studentGroup{db})
http.ListenAndServe(":8080", nil)
}
type studentGroup struct {
db *sql.DB
}
func (sg *studentGroup) list(w http.ResponseWriter, r *http.Request) {
}
func (sg *studentGroup) create(w http.ResponseWriter, r *http.Request) {
}
func (sg *studentGroup) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/list":
sg.list(w, r)
case "/create":
sg.create(w, r)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
}