File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1- import app from './app.js'
1+ /* import app from './app.js'
22import { connectDB } from './db/connect.js'
33
44const serverStart = async () => {
@@ -13,4 +13,28 @@ const serverStart = async () => {
1313 }
1414}
1515
16+ serverStart()*/
17+
18+ import app from './app.js'
19+ // CAMBIO: Importamos el objeto sequelize por defecto (sin llaves)
20+ import sequelize from './db/connect.js'
21+
22+ const serverStart = async ( ) => {
23+ try {
24+ // CAMBIO: Usamos authenticate() para verificar la conexión
25+ await sequelize . authenticate ( )
26+ console . log ( 'Database connected successfully' )
27+
28+ // Opcional: Si quieres que se sincronicen las tablas al arrancar:
29+ // await sequelize.sync()
30+
31+ app . listen ( app . get ( 'port' ) , ( ) => {
32+ console . log ( `Server running on port http://localhost:${ app . get ( 'port' ) } ` )
33+ } )
34+ } catch ( error ) {
35+ console . error ( 'Error starting server:' , error )
36+ process . exit ( 1 )
37+ }
38+ }
39+
1640serverStart ( )
You can’t perform that action at this time.
0 commit comments