main.go 725 B

123456789101112131415161718192021222324252627282930313233
  1. // QUIC web server with built-in support for Lua, Markdown, Pongo2 and JSX.
  2. package main
  3. import (
  4. "net/http"
  5. log "github.com/sirupsen/logrus"
  6. "github.com/xyproto/algernon/engine"
  7. )
  8. const (
  9. versionString = "Algernon 1.15.4"
  10. description = "Web Server"
  11. )
  12. func main() {
  13. // Create a new Algernon server. Also initialize log files etc.
  14. algernon, err := engine.New(versionString, description)
  15. if err != nil {
  16. if err == engine.ErrVersion {
  17. // Exit with error code 0 if --version was specified
  18. return
  19. }
  20. // Exit if there are problems with the fundamental setup
  21. log.Fatalln(err)
  22. }
  23. // Set up a mux
  24. mux := http.NewServeMux()
  25. // Serve HTTP, HTTP/2 and/or HTTPS. Quit when done.
  26. algernon.MustServe(mux)
  27. }