Skip to content

Latest commit

 

History

History
37 lines (34 loc) · 1.03 KB

File metadata and controls

37 lines (34 loc) · 1.03 KB

install:
npm i node-fetch
in config.js
insert this code:
exports.dokan = { endpoint: 'https://www.test.com/wp-json/', header: { method: 'get', headers: { 'Cache-Control': 'no-cache', 'Authorization': 'Bearer INSERT_YOUR_TOKEN_HERE' }, } }

for routes file test.js
insert:

var config = require('./config.js'); var fetch = require('node-fetch');
exports.getAllStores = function(callback) { fetch(config.dokan.endpoint + 'dokan/v1/stores/3', config.dokan.header) .then(res => res.json()) .then(json => { callback(json); }); }

in test.js you can change dokan/v1/stores/3 with your custom API from https://wedevsofficial.github.io/dokan/

in index.js

var test = require('./test'); router.get('YOUR_TRIGGER_URL', function(req, res, next) { test.getAllStores(function(result) { res.send(result); }); });