---
# System prepended metadata

title: Wenchin Appworks

---

# Wenchin Appworks

# Sql schema
```sql
DROP TABLE IF EXISTS `product`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
```

## db.js
```js
// DataBase 
const mysql = require('mysql');

const connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '0709',
    database: 'stylish'
});

connection.connect(function (err) {
    if (err) {
        console.log('MySQL connection error: ' + err.message);
        return;
    }
    console.log('Connected to the MySQL server');
});

async function GetProducts() {
    [products, fields] = await connection.query('SELECT * FROM product');
    products.forEach(product => {
    });
    [colors, fields] = await connection.query('SELECT * FROM color_object GROUP BY id');
    colors.forEach(color => {
    });
    [variants, fields] = await connection.query('SELECT * FROM variant_object GROUP BY id');
    variants.forEach(variant => {
    })
}

module.exports = db;

```