()
| 2 | import Image from "next/image"; |
| 3 | |
| 4 | export default function Home() { |
| 5 | const handleClick = async () => { |
| 6 | let data = { |
| 7 | name: "Shubham", |
| 8 | role: "Coder" |
| 9 | } |
| 10 | let a = await fetch("/api/add", { |
| 11 | method: "POST", headers: { |
| 12 | "Content-Type": "application/json", |
| 13 | }, |
| 14 | body: JSON.stringify(data), |
| 15 | }) |
| 16 | let res = await a.json() |
| 17 | console.log(res) |
| 18 | } |
| 19 | |
| 20 | return ( |
| 21 | <div> |
| 22 | <h1 className="text-xl font-bold">Next.js Api routes demo</h1> |
| 23 | <button onClick={handleClick}>click me</button> |
| 24 | </div> |
| 25 | ); |
| 26 | } |
nothing calls this directly
no outgoing calls
no test coverage detected