'Two pages hit same API Route nextJS
I have a problem, two pages hit the same API Route. Is it okay? Because everywhere on the internet I see that one API Route, with the same name which page has, goes for one page. What to do if two pages go for the same API Route? Is it okay?
const DetailedAssetCard: React.FC<funcProps> = (props) => {
// it is func when user search for item
const onAddToFavHandler = async () => {
await fetch("/api/search", {
method: "POST",
body: JSON.stringify(props.asset?.asset_id),
headers: {
"Content-type": "application/json",
},
});
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
