Node
Title | Code |
---|---|
|
npm list npm install name npm uninstall name |
|
nodemon sudo npm install -g nodemon [but package.json not record] npm install --save-dev nodemon npm install nodemon -D nodemon app.js [nodemon] app crashed - waiting for file changes before starting... sudo pkill -f node nodemon restart npx nodemon app.js |
|
[Faker install](https://fakerjs.dev/guide/) ### [Faker install](https://fakerjs.dev/guide/) - npm install @faker-js/faker --save-dev - import { faker } from '@faker-js/faker'; - const randomName = faker.person.fullName(); // Rowan Nikolaus - const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz ``` Location folder: seeders/seed file[category-seeder.js] ------------------------ const { faker } = require('@faker-js/faker'); const users = [...Array(20)].map((user) => ( { name: faker.person.firstName(), createdAt: new Date(), updatedAt: new Date() } )) module.exports = { async up (queryInterface, Sequelize) { await queryInterface.bulkInsert('Categories', users, {}); }, async down (queryInterface, Sequelize) { await queryInterface.bulkDelete('Categories', null, {}); } }; |