Node js Tutorial | Submit HTML Form Data

preview_player
Показать описание

TIMESTAMPS
00:00 Introduction
01:15 Nodejs application Directory
01:51 Download Node JS Express Package
02:24 Create Node js file
04:39 Create HTML form in Node application
07:52 Submit HTML Form Data in Node js
08:56 Check Output in browser

ABOUT OUR CHANNEL
Check out our channel here:
Don’t forget to subscribe!

CHECK OUT OUR OTHER VIDEOS

FIND SOURCE CODE AT

GET IN TOUCH

FOLLOW US ON SOCIAL
Get updates or reach out to Get updates on our Social Media Profiles!
Рекомендации по теме
Комментарии
Автор

Turn off the background music next time please

chennapreetham
Автор

You have made this more complicated than it needs to be by including Bootstrap code. Not to mention that you're not using VS Code but some random text editor this time. Talk about consistency.

floramerano
Автор

i was having trouble while installing express in the form directory, it was removing all the npm node modules. in that case i reinstalled nodejs in my computer then i deleted the form directory and then inside downloads folder i made a new folder and inside that folder i installed the express module with this command: "npm install express --save". then everything worked fine and i was able to continue.

betelhemyemane
Автор

can you show how to post this form data in a postgres table?

mohdabdulrafay
Автор

Sir you need to update the code as we are getting undefined or blank, so we need to add below in our code

const bp = require('body-parser');

app.use(bp.json());

TheMeet
Автор

It works teacher 🙂
Thank you very much 😊

ryansatriayudha
Автор

Thank you so much dear..
Your voice is so nice...

md.anwarhossain
Автор

Created same setup but I get no data returned. You need to post your code and ensuare your up to date.

StevenCookFX
Автор

4:42 why paste two times the same link?

branchyapple
Автор

I am trying to access form data using GET method. Can anyone tell me what is the error in the below code:

import express from "express";

const app=express()
const port = process.env.PORT || '4000'

app.use(express.urlencoded({
extended: false
}));
app.use(express.json());

app.get('/', (req, res) => {
res.send('Home Page');
})

app.get('/form', (req, res) => {
// res.setHeader('content-type',
res.write('<h1>Student Registration Form</h1>')
res.write('<h1>Student Registration Form</h1>')
res.write('<form method="GET" action="/handleForm" >')
res.write('<input type="text" value="name" placeholder="Name" /> <br/><br/>')
res.write('<input type="number" value="age" placeholder="Age" /> <br/><br/>')
res.write('<input type="submit" value="submit"/>')
res.write('<form/>')
res.send();
})

app.get('/handleForm', (req, res) => {
console.log(req.query)
res.send('Form Submitted')
})

app.listen(port, () => {
})

amartyajaiswal
Автор

Hey I tried the same code but it's showing {} and not the output

jain-daksh
Автор

music is too loud to listen to what you are saying

jr.devasana
Автор

Good job bro, JESUS IS COMING BACK VERY SOON; WATCH AND PREPARE

thechoosen