Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

313
Vistas
Hey can you help me out . my 'url.parse' is deprecated

line 5 @deprecated — since v11.0.0 - Use the WHATWG URL API.

The signature '(urlStr: string): UrlWithStringQuery' of 'url.parse' is deprecated url .The declaration was marked as deprecated here.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Here is the solution that worked for me.

const {URL} = require('url');

const getProfile = (req,res) => {
   const fullurl = req.protocol + '://' + req.get('host') + req.originalUrl;
   //E.g. http://127.0.0.1:3000/getProfile?pid=12345&section=NE
   
   const urlObj = new URL(fullurl);
   console.log(urlObj.searchParams.get('pid'));
   //prints 12345
   
   console.log(urlObj.searchParams.get('section'));
   //prints NE
}

over 4 years ago · Santiago Trujillo Denunciar

0

The new method is use WHATWG API in Node.Js
You can use the code below to get something like pathname:

const uri = 'https://yoururl.com/yourpathname'
const { URL } = require('url');
const yourUrl = new URL(uri);
const yourPathame = yourUrl.pathname.substr(1);

// yourUrl return 'https://yoururl.com/yourpathname'
// yourPathame return 'yourpathname'

The reference about WHATWG API is at Node.js website.

over 4 years ago · Santiago Trujillo Denunciar

0

Built-in url.parse was deprecated. The up to date api is URL. You can find more here: https://nodejs.org/api/url.html

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda