#Task for populate initial data

2 messages · Page 1 of 1 (latest)

bright dune
#

I have a nest application that integrates with mongodb a method that saves data in the database and another that searches for data, it is possible to create a script that when starting the application I can perform a search in an external api to populate the database, and that after this execution when stopping and starting again this event is no longer fired. My doubt is about this event calling external api and saving data in the bank I can perform

pine isle
#

You can easily create a .ts file, place your logic to search/populate the data there and then use ts-node to run the script. That is the way seeding is usually done with prisma but should be easily applicable anywhere