Next.js V14.0.2 API issues
Unanswered
Sirex woodwasp posted this in #help-forum
Sirex woodwaspOP
export default function handler(req, res) {
res.status(200).json({ message: 'Hello from Next.js!' })
}I copied this simple snippet from the site to test whether the api routing would work out and it doesn't.
I get the following error:
⨯ app\socket.io\page.js (2:8) @ status
⨯ TypeError: Cannot read properties of undefined (reading 'status')
at handler (./app/socket.io/page.js:6:9)
at stringify (<anonymous>)
digest: "3268381246"
1 | export default function handler(req, res) {
> 2 | res.status(200).json({ message: 'Hello from Next.js!' })
| ^
3 | }I try to access it like this:
socketRef.current = io(); Which then comes to /socket.io/?EIO=4....
Which should work as far as I know.