Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
NodeJS Check if the URL was updated

I'm using NodeJS (v. 17.8.0) and am using express.js to host my project. My goal is to pass something through the URL, take that something in NodeJS, and send it over a TCP connection. I've been able to update the URL over Vanilla JS but am having issues with the node-url module. 

Code thats updating the url:

    let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + 'para=' + id;
    window.history.pushState({path:newurl},'',newurl);

NodeJS code:

let express  = require('express');
let app = express();
let bodyParser = require('body-parser');

let url = require("url");
let net = require('net');

const path = require('path');



app.use(bodyParser.json());
app.use(express.static('public'));

    app.listen(3000, function(){
        console.log("Server started on port: 3000");
    })

    app.get('', (req, res) => {
        console.log(req.protocol)    
        console.log(req.hostname)     
        console.log(req.path)         
        console.log(req.originalUrl)  
        console.log(req.subdomains)   
      })
      
   

What would be the best way to achieve that?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda