Skip to content

Commit

Permalink
Create database connection before call endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoVictor committed Jul 8, 2024
1 parent 7bdaf6b commit 154fcd0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ const { ZodError } = require("zod");
const { env } = require("./env");
const { challenges } = require("./infra/http/challenge");
const { solution } = require("./infra/http/solution");
const { manager } = require("./infra/database/manager");

const app = express();

app.use(express.json());

app.use((req, res, next) => manager.connect().then(next));

app.use(challenges);
app.use(solution);

Expand Down

0 comments on commit 154fcd0

Please sign in to comment.