aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker/main.go
blob: 51c0eb121877851d463de33129178a0c09f845d5 (plain)
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
package main

import (
	"log"
	"net/http"

	// echojwt "github.com/labstack/echo-jwt/v4"
	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
)

func main() {
	if err := prepareDirectories(); err != nil {
		log.Fatal(err)
	}

	e := echo.New()

	e.Use(middleware.Logger())
	e.Use(middleware.Recover())

	// TODO: temporarily disabled
	// e.Use(echojwt.WithConfig(echojwt.Config{
	// 	SigningKey: []byte("TODO"),
	// }))

	e.POST("/api/swiftc", handleSwiftCompile)
	e.POST("/api/wasmc", handleWasmCompile)
	e.POST("/api/testrun", handleTestRun)

	if err := e.Start(":80"); err != http.ErrServerClosed {
		log.Fatal(err)
	}
}