MCPcopy Create free account
hub / github.com/blockmatic/basilic / initialize

Function initialize

apps/api/server.ts:49–68  ·  view source on GitHub ↗

* Initialize database and run migrations before starting server

()

Source from the content-addressed store, hash-verified

47 // 3. Run migrations
48 await runMigrations(logger)
49 } catch (err) {
50 fastify.log.error({ err }, 'Initialization failed')
51 throw err
52 }
53}
54
55const start = async () => {
56 try {
57 await fastify.listen({ port: env.PORT, host: env.HOST })
58 fastify.log.info({ port: env.PORT, host: env.HOST }, 'Server started')
59 } catch (err) {
60 fastify.log.error(err)
61 process.exit(1)
62 }
63}
64
65const startServer = async () => {
66 try {
67 // Initialize database and migrations before starting server
68 await initialize()
69
70 await start()
71 } catch {

Callers 1

startServerFunction · 0.85

Calls 3

waitForDatabaseFunction · 0.85
getDbFunction · 0.85
runMigrationsFunction · 0.85

Tested by

no test coverage detected