리스폰스1 백엔드의 전유물인 API를 Next.js로 다룰 수 있다고?! 넥스트로 리퀘스트를 어떻게 조작할까?🔖 경로에 해당하는 리퀘스트를 처리하려면, 페이지 라우팅과 비슷한 방식으로 api/경로.js와 같은 파일을 만들고 default export한다.import type { NextApiRequest, NextApiResponse } from "next";type ResponseData = { message: string;};export default function handler(req: NextApiRequest, res: NextApiResponse) { res.status(200).json({ message: "Hello from Next.js!" });}리퀘스트 객체는 어떤게 있어?🔖 리퀘스트 객체 종류프로퍼티타입설명method문자열리퀘스트로 들어온 HTT.. 2024. 6. 3. 이전 1 다음