Skip to content

Commit

Permalink
refactore: remove debugging clogs
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed May 30, 2024
1 parent d379bdd commit e44c061
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions src/server/db/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const runMigrations = async () => {
}

const testConnection = async () => {
console.log('Inside test connections')
await sequelize.authenticate()
await runMigrations()
}
Expand All @@ -35,7 +34,6 @@ const testConnection = async () => {
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

export const connectToDatabase = async (attempt = 0): Promise<void | null> => {
console.log('Inside connectToDb')
try {
await testConnection()
} catch (err: any) {
Expand Down
9 changes: 1 addition & 8 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,17 @@ const app = express()
app.use(['/api', '/public/api'], (req, res, next) => router(req, res, next))
app.use(['/api', '/public/api'], (_, res) => res.sendStatus(404))

console.log('Before ifs')
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') {
console.log('Inside first if')
const DIST_PATH = path.resolve(
dirname(fileURLToPath(import.meta.url)),
'../../build'
)
console.log('After dist path')

const INDEX_PATH = path.resolve(DIST_PATH, 'index.html')
console.log('After index path')
app.use(express.static(DIST_PATH))
console.log('After static')
app.get('*', (_, res) => res.sendFile(INDEX_PATH))
console.log('After get *')
}

console.log('After first if')

app.listen(PORT, async () => {
await connectToDatabase()
await seed()
Expand Down

0 comments on commit e44c061

Please sign in to comment.