-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (42 loc) · 832 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"github.com/rovarghe/mule/internal"
"github.com/rovarghe/mule/internal/builtin"
"github.com/rovarghe/mule/schema"
)
type H struct {
context context.Context
}
func (h *H) ServeHTTP(w http.ResponseWriter, r *http.Request) {
internal.Process(h.context, r)
/*
switch r.URL.Path {
case "/":
fmt.Println("RtmpOot served")
default:
http.DefaultServeMux.ServeHTTP(w, r)
}
*/
}
func startServer(ctx context.Context) error {
fmt.Println("Listening on port", 8000)
return http.ListenAndServe(":8000", &H{
context: ctx,
})
}
func main() {
var modules = []schema.Module{
builtin.CoreModule,
}
ctx, err := internal.LoadModules(context.Background(), modules)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
log.Fatal(startServer(ctx))
}