portfolio/main.go

34 lines
525 B
Go
Raw Normal View History

2024-02-13 18:45:08 +01:00
package main
import (
"github.com/joho/godotenv"
"log"
"net/http"
2024-05-16 18:42:31 +02:00
"portfolio/api"
2024-05-16 17:36:44 +02:00
"portfolio/database"
2024-05-16 18:42:31 +02:00
"portfolio/web"
)
2024-02-13 18:45:08 +01:00
func main() {
// load .env in runtime environment
err := godotenv.Load()
if err != nil {
log.Fatalf(".env not found: %v", err)
return
}
2024-05-15 15:49:39 +02:00
//connect to database and migrate
database.DB()
2024-05-16 18:42:31 +02:00
//init web routes
web := web.WebRoutes()
// Run web server
go http.ListenAndServe(":4001", web)
//init api routes
api := api.ApiRoutes()
//run api server
http.ListenAndServe(":4002", api)
2024-02-13 18:45:08 +01:00
}