brillout / wildcard-api

Functions as API.
MIT License
368 stars 14 forks source link

I have compiled the wildcard using bytenode but when running it gets "is an arrow function" #64

Closed mrluaf closed 4 years ago

mrluaf commented 4 years ago

D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\@brillout\assert\dist\assertUsage.js:9 throw getUsageError(errorMessage); ^

Error: [Wildcard API][Wrong Usage] The endpoint function laysaoke is an arrow function. Endpoints cannot be defined with arrow functions (() => {}), use a plain function (function(){}) instead. at getUsageError (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\@brillout\assert\dist\assertUsage.js:17:29) at Object.validateEndpoint [as set] (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\@wildcard-api\server\WildcardServer.js:125:14) at Object. (evalmachine.:1:182) at Object.Module._extensions. [as .jsc] (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\bytenode\index.js:225:26) at require (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\bytenode\index.js:204:19) at Object. (evalmachine.:1:246) at Object.Module._extensions. [as .jsc] (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\node_modules\bytenode\index.js:225:26) at Object. (D:\Develop\TEST\ZAX-Tool[MAIN] ZAX-BankingAPI\Services\vcb.service\dist\run.js:3:1) at internal/main/run_main_module.js:17:11

./vcb_modules/controller.js server['laysaoke'] = async function (data) { return new Promise(async function(resolve, reject) { try { ..... } catch (err) { ..... } }); }

./main.js require('./vcb_modules/controller');

brillout commented 4 years ago

Hello Lua,

Note these relevant changes made between wildcard-api@server@0.5.1 and wildcard-api@server@0.5.2: https://github.com/reframejs/wildcard-api/commit/80c00cabefc9eda180454cf2214c791d0959c785

Pinning between 0.5.1 and 0.5.2 may solve your problem in the meantime.

brillout commented 4 years ago

Let me know if you are still running into this issue. Happy to help.