21 lines
301 B
Go
21 lines
301 B
Go
package handlers
|
|
|
|
import (
|
|
"MiauInv/storage"
|
|
"net/http"
|
|
)
|
|
|
|
func CreateLocation(w http.ResponseWriter, r *http.Request) {
|
|
name := r.FormValue("name")
|
|
|
|
_, err := storage.DB.Exec(
|
|
"INSERT INTO locations(name) VALUES(?)",
|
|
name,
|
|
)
|
|
|
|
if err != nil {
|
|
http.Error(w, err.Error(), 500)
|
|
return
|
|
}
|
|
}
|