feat(01-02): add /ready endpoint with database connectivity check
- Add GET /ready endpoint that checks database connection - Returns 200 'ready' when connected, 503 when not - Update Routes to require DataSource dependency - Provide dataSourceLayer in Main.scala - Use 'hikari' prefix for HikariCP config to avoid ZIO config conflict
This commit is contained in:
@@ -4,6 +4,7 @@ import zio.config.typesafe.TypesafeConfigProvider
|
||||
|
||||
import api.Routes
|
||||
import _root_.config.{AppConfig as SummerConfig}
|
||||
import db.QuillContext
|
||||
|
||||
object Main extends ZIOAppDefault {
|
||||
|
||||
@@ -29,7 +30,11 @@ object Main extends ZIOAppDefault {
|
||||
_ <- Console.printLine(banner)
|
||||
_ <- Console.printLine(s" Starting on port ${cfg.server.port}...")
|
||||
_ <- Console.printLine("")
|
||||
_ <- Server.serve(Routes.routes).provide(Server.defaultWithPort(cfg.server.port))
|
||||
// Note: Migrations are NOT auto-run. Use CLI to run migrations (Phase 5).
|
||||
_ <- Server.serve(Routes.routes).provide(
|
||||
Server.defaultWithPort(cfg.server.port),
|
||||
QuillContext.dataSourceLayer
|
||||
)
|
||||
} yield ()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user