chore: Implement logger with winston library

This commit is contained in:
Faruk AYDIN
2021-10-04 18:01:14 +02:00
committed by Ali BARIN
parent a62d5369d4
commit 7a675e6c79
8 changed files with 254 additions and 65 deletions

View File

@@ -1,14 +1,15 @@
import appEnv from './config/app-env'
import appConfig from './config/app'
import createError from 'http-errors';
import express, { Request, Response, NextFunction } from 'express';
import logger from 'morgan';
import logger from './helpers/logger';
import morgan from './helpers/morgan';
import indexRouter from './routes/index';
const app = express();
const port = appEnv.port;
const port = appConfig.port;
app.use(logger('dev'));
app.use(morgan);
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
@@ -31,5 +32,5 @@ app.use(function(err: any, req: Request, res: Response, _next: NextFunction) {
});
app.listen(port, () => {
return console.log(`Server is listening on ${port}`)
logger.info(`Server is listening on ${port}`)
})