not sure what the "generate" line does inside package.json (I am referring to "generate": "node ./server/generate.js > ./server/database.json",
) of an angular project or where to find out more about this, any references or tips please? I am ready to delete the question if you guys think it's lacking in details.
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",r
"lint": "ng lint",
"e2e": "ng e2e",
"generate": "node ./server/generate.js > ./server/database.json",
"server": "json-server --watch ./server/database.json"
},
So basically generate.js builds an object named database, initialised as: var database = { products: []};
(this is just before adding fake data to the "products" subtype); whereas, database.json just contains this:
{
"products": []
}
What does this node ./ (a path) / file > (path to json) do? What do you need > for?
What if I add the code to populate database with fake data inside of a .ts class instead of a js file?
And can I directly type a command like this "node ./server/generate.js > ./server/database.json" from the terminal instead of "npm run generate"?