This is my code.
var express = require('express');
var router = express.Router();
var WooCommerceAPI = require('woocommerce-api');
var WooCommerce = new WooCommerceAPI({
url: 'https://example.ro',
consumerKey: 'ck_xxxxxxxxxxxxxxxxx',
consumerSecret: 'cs_xxxxxxxxxxxxxxxx',
wpAPI: true,
version: 'wc/v1'
});
router.get('/', function(req, res) {
WooCommerce.get('products', function(err, data, res) {
console.log(res);
});
});
module.exports = router;
And i cant seem to find a solution to print the json to the route. I do get a the console log in the terminal.
I tried res.json(res)
inside WooCommerce.get but i get an error(res.json not a function).