interface Logger { info: (msg: string) => void }
class ConsoleLogger implements Logger { info(msg: string): void { console.log("[Console]:", msg) } }
class PinoLogger implements Logger { info(msg: string): void { console.log("[Pino]:" , msg) } }
// Part 1: Business Entities
async getUserData(): Promise<UserData> {
return { name: "Big Lebowski" }
constructor(private data: UserData) {}
name = () => this.data.name
constructor(private readonly logger: Logger, private readonly user: User) {}
this.logger.info(`Sending monery to the: ${this.user.name()} `)
export async function runMyApp() {
process.env.NODE_ENV === "production"
const auth = new AuthService()
const user = new User(await auth.getUserData())
const paymentService = new PaymentService(logger, user)
paymentService.sendMoney()
console.log(" ---- My App START \n\n")
console.log("\n\n ---- My App END")