Create .env file similar to .env.example
PORT=4000
DATABASE_HOST=localhost
DATABASE_PORT=3306
DATABASE_USER=travelist_user
DATABASE_PASS=travelist
DATABASE_NAME=travelistdbyarn start
logger.log("severity", "message");
Severity Values: error, warn, info, verbose, debug, silly
await AppDataSource.manager.insert<Country>(Country, {
// ...
})
const countries = await AppDataSource.manager.find<Country>(Country)
// Find with relations example
await AppDataSource.getRepository(Company).findOne({
where: {
id: parseInt(req.params.id),
},
relations: {
user: true,
},
})
// Find with nested relations example
const cycle = await AppDataSource.getRepository(Cycle).findOne({
where: {
id
},
relations: ["program", "program.company", "bookings", "reviews"],
})Hashing using BCrypt