A simple way to handle form submissions from static websites.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
395 B

4 years ago
4 years ago
4 years ago
  1. package main
  2. import (
  3. "log"
  4. "net/http"
  5. "strconv"
  6. )
  7. var appConfig *config
  8. func init() {
  9. cfg, err := parseConfig()
  10. if err != nil {
  11. log.Fatal(err)
  12. }
  13. appConfig = cfg
  14. }
  15. func main() {
  16. if !checkRequiredConfig(appConfig) {
  17. log.Fatal("Not all required configurations are set")
  18. }
  19. http.HandleFunc("/", FormHandler)
  20. log.Fatal(http.ListenAndServe(":"+strconv.Itoa(appConfig.Port), nil))
  21. }