1

I am learning wit.ai and going through the tutorial (https://wit.ai/docs/quickstart). Everything else went well till step 6, where it asked me to clone the node.js client and install npm. Usually, I create a separate node.js project then npm intall whatever-the-module-is then use it.

I am confused on how to use node-wit. I want to create my own node.js server which will be called by my bot to implement the business logic. Here are few questions I need help with:

  1. Can I just create a basic node.js project, install node-wit and use it?

  2. If I deploy my node project on heroku, where do I provide the endpoint for wit.ai to call? The tutorial does not mention anything about it.

  3. Can I perform the business logic without using Promise or any code they have given in the node-wit tutorial?

Overall I am just confused on how the node-wit code is working.

Thanks.

codeinprogress
  • 3,193
  • 7
  • 43
  • 69

1 Answers1

2

1) Yes you can. Simply run npm install --save node-wit, check out the github for more infos https://github.com/wit-ai/node-wit

2) Endpoints url are set within the module. Check the lib/config.js file. You just have to specify your API key to communicate with Wit.

3) The SDK uses only promises, so you have to use them too. Two solutions here : i) master this concept, my guess is that's it's worth it since promises are very handfull ii) code your own API calls, this is not difficult (check the HTTP API doc)

Nitsuja
  • 73
  • 6
  • Where should i host this app ? Its working fine locally but when i pushed it to my static hosting i am getting no cross browser origin access allowed error. So will this work if i move my app to a node based hosting ? – AmitJS94 Dec 29 '16 at 10:46