0
How to receive inputs with nodejs and send a value to a given page element? Example:
const fs = require('fs');
const http = require("http");
http.createServer((req, res)=>{
fs.readFile('index.html',(err, data)=>{
res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
res.write(data);
res.end();
});
let nome = recebe_nome_do_elemento_yourName_da_pagina_html.
enviar nome para_elemento_showName+" Seja bem vindo!";
}).listen(8080);
console.log("rodando em http://localhost:8080");
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<input type="text" name="yourName">
<div name="showName"></div>
</body>
</html>
remembering that if possible the value is sent to the same origin page.