Sending Html Form Data To Node Js May 03, 2024 Post a Comment I have the following code Solution 1: I got it to work. Here's the code:var express = require('express'); var app2 = express(); var bodyParser = require("body-parser"); var path = require('path'); var socketIO = require('socket.io'); app2.use(bodyParser.urlencoded({ extended: false })); app2.use(bodyParser.json()); var app = http.createServer(app2); `var io = socketIO.listen(app);` app2.use( express.static(__dirname)); app2.post('/form', function(req, res){ var lang = req.body.mytext; console.log( req.body.mytext); res.send(lang); }); app.listen(8081); CopyDespite having created a server using express, I still needed to create the server using the HTTP module because an express server doesn't work with the socket.io module. And I had used the express server to take care of my static files.Baca JugaHow To Render Variable From Node.js Server Without Have To Reload And Without Using Ejs/ajax?Multipart/form-data Form With No Field NamesSend Data To Node.js Server From Html Form Share You may like these postsHow To Make A Static Sign Of A Currency In The Input TagTriggering A Fade In/fade Out From Another Element Causes The Fading Element To Stick When Switching Trigger ElementsFloating Div Extra Space FillupHow Can I Append Text To Html Source In Ckeditor? Post a Comment for "Sending Html Form Data To Node Js"
Post a Comment for "Sending Html Form Data To Node Js"