Advertisement
reggi

Untitled

Jul 29th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The real-world example is here:
  2.  
  3. in libraries/application.js
  4.  
  5. exports.dashboard = function(req,res){
  6.   shopify.request({
  7.     "method":"GET",
  8.     "url":"/admin/shop.json",
  9.     "shop":shop.name,
  10.     "access_token":shop.access_token,
  11.     "request": false,
  12.   }
  13.   ,function(error, response, data) {
  14.     res.send(data);
  15.   });
  16. }
  17. in libraries/shopify.js
  18.  
  19. exports.request = function(args,func){
  20.   var request = require('request')
  21.     , predefined = {
  22.         method: args.method,
  23.         url: "https://"+args.shop+args.url,
  24.         headers:{'X-Shopify-Access-Token': args.access_token,},
  25.         json: true,
  26.       };
  27.   request(predefined,func);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement