Add initial frontend and backend

This commit is contained in:
Dave Gallant
2022-07-31 02:58:08 +00:00
parent 6709422ba0
commit 3173b47951
23 changed files with 6760 additions and 1 deletions

51
backend/main.go Normal file
View File

@@ -0,0 +1,51 @@
package main
import (
"os"
_ "github.com/joho/godotenv/autoload"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
utils "github.com/davegallant/rfd-launcher/pkg/utils"
)
// @title RFD Launcher API
// @version 1.0
// @description An API for an issue tracking service
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8080
// @BasePath /api/v1
func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
a := &App{}
dbType := utils.GetEnv("DB_TYPE", "sqlite3")
httpPort := utils.GetEnv("HTTP_PORT", "8080")
sqlitePath := utils.GetEnv("SQLITE_DB_PATH", "rfd.db")
// Determine database
switch {
case dbType == "sqlite3":
log.Debug().Msgf("Using sqlite3 (path: " + sqlitePath + ")")
a.Initialize(dbType, sqlitePath)
default:
log.Fatal().Msgf("Unsupported database: " + dbType)
}
a.Run(httpPort)
}