Skip to content

Routes & Directory Structure

Monday, 01 Jul 2024
       

Routes & Directory Structure

TIP

กำหนดแนวปฎิบัติการสร้างแฟ้มให้สอดคล้องกับ route เนื่องจาก Frontend และ Backend จะต้องใช้โดเมนเดียวกันและใช้โดเมนร่วมกันหลายระบบ

Frontend

Backend

WARNING

Frontend ห้ามใช้ชื่อ route /.../api สำหรับการเข้าใช้งาน

เพราะอาจจะทำให้ไปซ้ำซ้อนกับ route ของ Backend และจะทำให้ใช้งานไม่ได้

Frontend NuxtJS

  • Kong route: /complaint
  • Frontend URI: /complaint/home
Directory Structure

├── components
│   └── complaint
|   |   └── HomeComponent.vue
└── pages
    └── complaint
        └── home
            └── HomePage.vue

Backend Fastify

  • Kong route: /complaint/api
  • Backend URI: /complaint/api/v1/home
text
Directory Structure

├── routes
|   └── complaint
|   |    └── api
|   |        └── V1
|   |            └── home
|   |                └── home.js
└── services
    └── v1
        └── home
            └── home.js

Built with: VitePress.