-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38be08e
commit d37aa04
Showing
75 changed files
with
2,173 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import expressWinston from 'express-winston'; | ||
import logger from '@/config/logger'; | ||
|
||
const expressWinstonLogger = (level = 'http') => { | ||
return expressWinston.logger({ | ||
level, | ||
winstonInstance: logger, | ||
meta: true, | ||
msg: `HTTP {{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}`, | ||
expressFormat: true, | ||
colorize: true, | ||
}); | ||
}; | ||
|
||
export default expressWinstonLogger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLogger } from 'winston'; | ||
import 'winston-daily-rotate-file'; | ||
import { consoleTransport, elasticSearchTrnasport } from '@/utils/transports'; | ||
|
||
const logger = createLogger({ | ||
transports: [elasticSearchTrnasport, consoleTransport], | ||
}); | ||
|
||
export default logger; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
services/appointment/src/redis.ts → services/EHR/src/config/redis.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Request, Response, NextFunction } from 'express'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
||
const setCorrelationId = (req: Request, res: Response, next: NextFunction) => { | ||
const key = 'x-correlation-id'; | ||
const correlationId = req.headers[key] || uuidv4(); | ||
|
||
req.headers[key] = correlationId; | ||
res.set(key, correlationId); | ||
|
||
next(); | ||
}; | ||
|
||
export default setCorrelationId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import 'dotenv/config'; | ||
import http from 'http'; | ||
import app from './app'; | ||
import app from '@/app'; | ||
import logger from '@/config/logger'; | ||
|
||
const server = http.createServer(app); | ||
|
||
const port = process.env.PORT || 4002; | ||
const serviceName = process.env.SERVICE_NAME || 'EHR-Service'; | ||
|
||
server.listen(port, () => { | ||
console.log( | ||
`${serviceName} service is listening at http://localhost:${port}` | ||
); | ||
logger.info(`${serviceName} service is listening at http://ehr:${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TransformableInfo } from 'logform'; | ||
|
||
// Format params | ||
const formatParams = ({ | ||
timestamp, | ||
level, | ||
message, | ||
...args | ||
}: TransformableInfo): string => { | ||
const ts = timestamp.slice(0, 19).replace('T', ' '); | ||
return `${ts} [${level}]: ${message} ${ | ||
Object.keys(args).length > 0 ? JSON.stringify(args) : '' | ||
}`; | ||
}; | ||
|
||
export default formatParams; |
Oops, something went wrong.