404 HTML page for API response
Answered
Round sardinella posted this in #help-forum
Round sardinellaOP
Hey there,
I'm trying to POST my http://localhost:3000/newroute with postman but I get the 404 not found HTML page in response
I'm trying to POST my http://localhost:3000/newroute with postman but I get the 404 not found HTML page in response
app/api/newrouteimport type { NextApiRequest, NextApiResponse } from "next";
type ResponseData = {
message: string;
};
export default function handler(
req: NextApiRequest,
res: NextApiResponse<ResponseData>
) {
res.status(200).json({ message: "Hello from Next.js!" });
}Answered by B33fb0n3
you can't access your localhost from outside of your network. You can publish your page for a specific time using ngrok for example. With this you can also easily get an https://... then you can access from outside this url with the specific api
4 Replies
you can't access your localhost from outside of your network. You can publish your page for a specific time using ngrok for example. With this you can also easily get an https://... then you can access from outside this url with the specific api
Answer
@B33fb0n3 you can't access your localhost from outside of your network. You can publish your page for a specific time using ngrok for example. With this you can also easily get an http**s**://... then you can access from outside this url with the specific api
Round sardinellaOP
Thank you, this means a lot to me.
I've been trying to find an answer for too long
great to hear I could help 🙂
please mark solution
please mark solution