AdonisJs. Implementing Seeds and Factories with log to a file

$2a$10$ENaedK0S9DgtXfrBKAOHPOOG7hLnD3TiuV5BaK0A0yL09iIs0Nmka

Creating Seed

adonis make:seed User

You can easily use simple implementation from example below, but I wanted to create a function, that will create multiple entities in database, not just one. It will be frustrating to run script each time just for one record

Creating Factory

Configuring Logger

const { format } = require('winston');

const moment = use('moment');

const { combine, timestamp, printf } = format;

const myFormat = printf(({ level, message, timestamp }) => `${level.toUpperCase()} [${moment(timestamp)
.format('YYYY MMMM DD, h:mm:ss')}]\n${message}`);
adonis seed

Java, Spring, Node.js, AdonisJs, React.js and Flutter developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store