Next.js Discord

Discord Forum

How to extract query from fetch call in route.js file inside an api route in next js?

Unanswered
i_lost_to_loba_kreygasm posted this in #help-forum
Open in Discord
js 
fetch("http://localhost:3000/api/search?q="+searchInput)
        .then(r => r.json())
        .then(c => console.log(c))

export async function GET(req) {
    console.log(req.query)
    return Response.json({books:books})
}
req.query doesnt work

0 Replies