Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
How do I pass a data from an HTML form to my Node.js file?

Hope you are well. I am currently new to this side of web-development, and was wondering how my HTML files communicate with the Node.js side of things.

So from my understanding, Node.js only runs from the command line through "node file.js" and my HTML files run on my browser, but how do they communicate?

I have a few promises on my Node.js file which get data from an API endpoint, but currently to test, I define the "ID" (which i send to the endpoint) in the Node.js manually, how do I let the HTML (user) do this? and vice versa, how do I pass the JSON data which i receive to the HTML side.

Im extremely sorry if i've asked the wrong question, quite new to this type of development. Thank you so much in advance :)

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

So from my understanding, Node.js only runs from the command line through "node file.js" and my HTML files run on my browser, but how do they communicate?

Most commonly, when you want Node.js and an HTML document to communicate you would write an HTTP server using Node.js (often with the Express.js framework) and then make HTTP requests (e.g. with a form submission or Ajax).

There are other options, such as Electron or OpenFin which are used for building desktop apps wrapped around HTML and Node.

about 4 years ago · Juan Pablo Isaza Report

0

In Node.js you have the option to build a server with Express, you can look at the documentation and see how it works. in express, you will send REST API requests. you can send HTML files in the request to communicate with the client.

But if you want to serve static files such as images, CSS files, and JavaScript files, use the express static built-in middleware function in Express.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!