Skip to content

Commit

Permalink
Remove unnecessary code and export app
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcrammer committed Apr 2, 2024
1 parent e8fb2fd commit 57332ff
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import "dotenv/config"
import cors from "cors"
import cookieParser from "cookie-parser"
import helmet from "helmet"
import sequelize from "./config/database"
import requireSSL from "./middleware/requireSSL"

// Routes
Expand All @@ -20,7 +19,6 @@ import totpRoutes from "./routes/totpRoutes"

import "./models/index"

const PORT = process.env.PORT || 3000
const app = Express()

app.set("trust proxy", 1)
Expand All @@ -39,12 +37,4 @@ app.use("/users", userRoutes)
app.use("/refresh", refreshRoutes)
app.use("/totp", totpRoutes)

app.listen(PORT, async () => {
try {
await sequelize.sync()
} catch (error) {
if (process.env.NODE_ENV !== "development") return
// eslint-disable-next-line no-console
console.error("Error syncing database:", error.message)
}
})
export default app

0 comments on commit 57332ff

Please sign in to comment.