Add initial Nuxt 4 project setup with essential configurations
- Created .gitignore to exclude build outputs, logs, and environment files. - Added nuxt.config.ts for project configuration, enabling Tailwind CSS and Pinia modules. - Initialized package.json with scripts for development and production, and added necessary dependencies. - Generated pnpm-lock.yaml for dependency management. - Created README.md with setup instructions and development guidelines. - Implemented server API examples in server/api/ directory, demonstrating various use cases. - Added middleware for logging requests and responses. - Included example Vue components and pages for server API interaction. - Established basic project structure for Nuxt 4 application development.
This commit is contained in:
14
server/api/01-hello.get.ts
Normal file
14
server/api/01-hello.get.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 케이스 1: 기본 GET 엔드포인트
|
||||
*
|
||||
* - 파일명에 .get.ts 접미사 → GET 요청만 처리
|
||||
* - URL: GET /api/01-hello
|
||||
* - eventHandler()로 요청 핸들러 정의
|
||||
* - 객체/문자열/숫자 모두 반환 가능 (자동 JSON 직렬화)
|
||||
*/
|
||||
export default defineEventHandler(() => {
|
||||
return {
|
||||
message: "안녕하세요! Nitro 서버입니다.",
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user