Skip to content

Commit

Permalink
Import custom error handler and add to middleware to catch all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-Quinn51 committed Nov 22, 2024
1 parent addc20c commit 0ca3462
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import express, { type Request, type Response } from "express";
import "dotenv/config";
import jobRoutes from "./routes/jobRoutes.ts";
import { errorHandler } from "./errors/errorHandler.ts";

const app = express();
app.use(express.json());

app.use("/jobs", jobRoutes);
app.use(errorHandler);

app.listen(process.env.PORT || 3000, () => {
console.log(`running on port ${process.env.PORT}`);
Expand Down

0 comments on commit 0ca3462

Please sign in to comment.