Search code examples
javascripthtmlnode.jstelegram-botnode-telegram-bot-api

Run node.js app from html by pressing a button


I made a telegram bot in node js and I would like to be able to start it by pressing a button from an html page, how can I do it? also I would like that even after the web page is closed, the bot continues to work.

To run the bot from the console I use the command: node bot.js


Solution

  • The best way will be: Creating a server in nodejs and post the request from the html button.

    STEP 1: Create html from for sending request to server: Can a html button perform a POST request?

    STEP 2: Create the server for receiving the request and do the work: How is an HTTP POST request made in node.js?