Under Development an Open-source E-commerce Framework
// promises
const getProducts = async (req, res, next) => {
pool
.query(getAllProductsQuery)
.then((result) => {
res.status(200).json({
success: true,
data: result.rows,
});
})
.catch((e) => res.json(e.stack));
// Async await
try {
const result = await pool.query(getAllProductsQuery);
res.status(200).json({
success: true,
data: result.rows,
});
} catch (err) {
res.json(err.stack);
}
};
- Create a Seeder => Not DONE
- Create Validator for Post and Put Methods => Not DONE
- Add cross-env to the project
export NODE_ENV=DEVELOPMENT
catchAsyncErrors
is used when try catch is not used to catch the error
RUN TIME "program": "${workspaceFolder}/backend/server.js"
MailTrap is used to send mail to customers.