I'm trying to read the search params in this URL: /api/getblogs?limit=5
export const get: APIRoute = async function get({ request }) {
const urlData = new URL(request.url);
console.log(urlData);
// other code
}
The console.log() logs the following:
URL {
href: 'http://127.0.0.1:3001/api/getblogs',
origin: 'http://127.0.0.1:3001',
protocol: 'http:',
username: '',
password: '',
host: '127.0.0.1:3001',
hostname: '127.0.0.1',
port: '3001',
pathname: '/api/getblogs',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
The searchParams property is empty, am I doing something wrong?