Started with items
This commit is contained in:
21
handlers/projects.go
Normal file
21
handlers/projects.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"MiauInv/storage"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CreateProject(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
name := r.FormValue("name")
|
||||
|
||||
_, err := storage.DB.Exec(
|
||||
"INSERT INTO projects(name) VALUES(?)",
|
||||
name,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user