简体   繁体   中英

Locu-node TypeError: Cannot call method 'call' of undefined

I'm using the locu-node node.js library found here: https://github.com/Locu-Unofficial/locu-node , which is an API client for the Locu service. In the example code provided, you can perform a query by doing the following:

do_search = function() {
  var locu = require('locu');
  var my_client = locu.MenuItemClient(apiKey);
    my_client.search({
      name:'pizza',
      description:'delicious',
      locality:'san francisco'
    },
    function(result) {
      console.log(result);
    }
  );

exports.do_search = do_search;

This code is sitting in a handler.js module that I call via a route. When I call that route, I get this error:

TypeError: Cannot call method 'call' of undefined at Object.MenuItemClient ... \\locu.js:179:15

, which is where the locu module tries to initialize the MenuItemClient. Has anyone used this library either successfully or run into this problem? Am I doing/not doing something stupid?

使用new关键字。

  var my_client = new locu.MenuItemClient(apiKey);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM