Skip to content

Commit

Permalink
Add basic backend logging with morgan.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Nov 16, 2023
1 parent bc3f8d1 commit 32c6a40
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
61 changes: 61 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"express": "^4.18.2",
"morgan": "^1.10.0",
"zod": "^3.22.2"
},
"devDependencies": {
"@types/cors": "^2.8.14",
"@types/express": "^4.17.17",
"@types/morgan": "^1.9.9",
"@types/node": "^20.6.3",
"prisma": "^5.3.1",
"ts-node": "^10.9.1",
Expand Down
4 changes: 4 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ApiResponse } from './types';
import modelRouter from "./routes/modelRoutes";
import bodyParser from "body-parser";
import webhookRouter from "./routes/webhookRoutes";
import morgan from 'morgan';

const app = express();
const port = env.PORT ?? 3000;
Expand All @@ -14,6 +15,9 @@ app.use(bodyParser.json());
// CORS middleware
app.use(cors());

// Logging
app.use(morgan('combined'))

// My implemented routers
app.use(modelRouter);
app.use(webhookRouter);
Expand Down

0 comments on commit 32c6a40

Please sign in to comment.