I am fairly new to using Strapi the headless CMS. I am trying to populate some data into my database, just like using knex with node js, however, I am not sure about doing this. I have seen a tutorial where inside the config/functions/bootstrap.js
, we would module.export
an asynchronous function that will populate the data; I have defined my code like so:
"use strict";
const data = [
{
title: "string",
description:"string",
director: "string",
assistantDirector: "string",
directorOfPhotography: "string",
firstAc: "string",
sound: "string",
thumbnail: "",
images: "",
hairAndMakeUp: "string",
productionAssistant: "string",
writer: "string",
cast: "string",
video: "string",
dateFilmed: 2020,
}];
module.exports = async () => {
data.forEach(reel => {
await strapi.services.reel.create({
title: reel.title,
description: reel.description,
director: reel.director,
assistantDirector: reel.assistantDirector,
directorOfPhotography: reel.directorOfPhotography,
firstAc: reel.firstAc,
sound: reel.sound,
hairAndMakeUp: reel.hairAndMakeUp,
productionAssistant: reel.productionAssistant,
writer: reel.writer,
cast: reel.cast,
video: reel.video,
dateFilmed: reel.dateFilmed,
});
})
};
However, after running strapi develop
I get a Error while running command develop: undefined
error. What am I missing?
Thank you for your time.