aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker/swift/main.go
blob: 02a0a6a578326b85db218121fcb63262fe9c5850 (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
package main

import (
	"log"
	"net/http"

	"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())

	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)
	}
}