I'm a self taught front end dev and now I'm exploring more facets of our field and I need some help connecting the dots with the backend. Apologies if this question is too broad.
I'd like to use faker.js to set up a few thousand fake users in json and have that served out to a front end project in Node JS where I could grab the data and use it in the browser.
I know how to generate one user via my data.js file and executing "node data" in the terminal:
var faker = require('faker');
var user = {
name: faker.name.findName(),
email: faker.internet.email(),
address: faker.address.streetAddress(),
bio: faker.lorem.sentence(),
image: faker.image.avatar()
};
console.log(user);
but how would I set this up to create 2000 users for example and what is the proper way to save it (I don't want to just copy a console.log and save to a file)?
Then how would I serve that out for my front end project? I've read articles that mention serving it out through a different port but not how. Then I've read that I can use a tool like "Postman" to see that data even without my project yet.
If anyone can help me connect these dots with how or online documentation, I'd appreciate it, thanks!