Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Oye me puedes ayudar. mi 'url.parse' está en desuso

línea 5 @deprecated — desde v11.0.0 - Use la API de URL de WHATWG.

La firma '(urlStr: string): UrlWithStringQuery' de 'url.parse' está obsoleta url. La declaración se marcó como obsoleta aquí.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Aquí está la solución que funcionó para mí.

 const {URL} = require('url'); const getProfile = (req,res) => { const fullurl = req.protocol + '://' + req.get('host') + req.originalUrl; //Eg 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 Report

0

El nuevo método es usar la API WHATWG en Node.Js
Puede usar el siguiente código para obtener algo como el nombre de la ruta:

 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'

La referencia sobre la API de WHATWG se encuentra en el sitio web de Node.js.

over 4 years ago · Santiago Trujillo Report

0

El url.parse incorporado quedó en desuso. La API actualizada es URL. Puede encontrar más aquí: https://nodejs.org/api/url.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!