Answer the question
In order to leave comments, you need to log in
How to process post request on node.js from front to js?
How can I send a request to a node.js file, process it and return a value?
PS: Gitlab has a pure layout that auto-deploys to the server where node.js is installed. In node.js, you need to work with mail chimp. And I can't figure out how to organize it.
I used to do this in php. I placed a php file in the root of the site, sent a request to it via ajax. This php file was processed by the server, after which I sent the value to the front.
How can you do this in node.js? Is it possible to send a request to the mail.js file so that it is processed and returns a value like in php?
Answer the question
In order to leave comments, you need to log in
Node.js has a built-in http server + fs module to work with the file system. The official site has a ready-made code for this
https://nodejs.org/en/knowledge/HTTP/servers/how-t...
You can create a file with a server for a specific port in Node.js and run it with the node server command. js in this case, you will start an http server that will respond to your requests from the browser on a specific port, localhost: 8080, for example. Then everything will be like in php, you can send POST or GET requests to it, perform the operations you need and give the desired response to the browser or script from the backend.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question