Search code examples
javascripthtmljsone-commerceproduct

How to add products and display them on a website?


I know they say there's no stupid questions but here's one. Let's say you're coding a website from scratch with only html, css and js.

What are the ways to add and display products on a website?

I saw some people add them in the HTML and I saw some who make a JSON file for the products and display them through JavaScript.

Now, are those the only ways? and what's the best or your personal favorite way? Keep in mind that you need to keep track of the inventory and the amount of each product in stock.

Any advice would be appreciated.


Solution

  • those two ways are when you want to build a static page and don't expect it to update or test a quick little feature. Later when your data grows

    for example: you add multiple products to the inventory.

    You need to look how to build apis and Create, Read, Update, Delete (CRUD) operations. There are lot of resources available on youtube/google search on how to use apis and get items through api calls.