Project: expressjs
Task (easy): 1) Create libs/db.js to export a new sqlite3.Database(process.env.DB_HOST) by node-sqlite3. 2) add libs/setup.sql to create tables for products (id, name, price, image, description, quantity). 3) POST /api/products to insert product data (Request Body follow {'name': 'SKU', 'price': 1234, image: 'xxx', description: 'xxx', quantity: 100}). Return { success: true, data: {'id': 'xxxx' } } when inserted successfully 4) GET /api/products to fetch all products. Return { success: true, products: [{'id':'xxx', 'name': 'SKU', 'price': 1234, image: 'xxx', description: 'xxx', quantity: 100}] } when fetched successfully. 5) all apis generated in this tasks should be placed in routes/products/api.js and used by app entry(index.js) as Express Router