Next.js Discord

Discord Forum

Trying to grab keywords using TextRazor API in Nextjs

Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
So I was trying to connect to the TextRazor API using Nextjs to grab keywords from a text string but it was returning a CORS error when running locally with yarn. I used the Nextjs docs to implement CORS solution but now it just returns a 404.

Here's the code: How do I fix this. Please help

2 Replies

fuma 💙 joulev
You no longer have the res parameter in route handlers, please read the [Route Handlers]( docs to learn to use route handlers in App Router.
Access-Control-Allow-Methods should be a header added to your NextResponse, but normally you won’t need the headers since they live under the same domain.
Btw the docs has an example for enabling CORS