John
John

Reputation: 1

Combining node.js with a local server

So I have created a local web server that uses jQuery. I also have a Twitch IRC bot which utilizes node.js along with the TMI and TwitchAPI library.

Goal I want to use the local web server to manage the IRC bot. For instance, the local server would have START_Button which would run a Connect method within the IRC Bot.

Problem: How would I execute a node.js script using a simple HTML input button. When I call the Connect method, I get a require(...) is not defined and found out why with a little research .

Any ideas?

Upvotes: 0

Views: 67

Answers (1)

Dennis Yarmosh
Dennis Yarmosh

Reputation: 214

If you want to run Node.js script on button press, you should:

  1. Start the local web server
  2. Make it serve HTML page, that has the button
  3. On button press send HTTP request to the server
  4. The request hander can then run any Node.js code you want

Upvotes: 3

Related Questions