forked from xyproto/algernon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (29 loc) · 752 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// HTTP/2 web server with built-in support for Lua, Markdown, GCSS, Amber and JSX.
package main
import (
"net/http"
"os"
log "github.com/sirupsen/logrus"
"github.com/xyproto/algernon/engine"
)
const (
versionString = "Algernon 1.8"
description = "Web Server"
)
func main() {
// Create a new Algernon server. Also initialize log files etc.
algernon, err := engine.New(versionString, description)
if err != nil {
if err == engine.ErrVersion {
// Exit with error code 0 if --version was specified
os.Exit(0)
} else {
// Exit if there are problems with the fundamental setup
log.Fatalln(err)
}
}
// Set up a mux
mux := http.NewServeMux()
// Serve HTTP, HTTP/2 and/or HTTPS. Quit when done.
algernon.MustServe(mux)
}