NickName:DCS Ask DateTime:2018-07-20T06:41:56 Node.js and HTML I am new to node.js and I'm trying to run a script that uses Node.js' require() when a html button is clicked but it simply says "require" is not recognized (which makes sense). So how exactly can I activate my node.js script when the HTML button is clicked in this case? Thank you. Copyright Notice:Content Author:「DCS」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.Link to original article:https://stackoverflow.com/questions/51432657/node-js-and-html Answers Dupocas 2018-07-19T22:48:06 You could use some library like express to handle requests and responses easely. In your case when the button is clicked a request is done to a server thats running node, the server handles the request and then sends back a response.\n\nSee more in Anatomy of an HTTP Transaction in Node's oficial docs.", Ashish Dommety 2018-07-19T22:52:45 The purpose of Node.js is to write server-side code in Javascript. This means that you can't use this functionality in the browser.\n\nHowever, to accomplish what you were asking, you can use a framework like Express.js (a node package with Node.js)\n\nThen, you need to set up an ajax request from the front-end that communicates with your server. You can launch an asynchronous call once your button is clicked, which can be received on the back-end using Express.js",