jchue / disney-parks-api

A personal project to learn how to create a static API using Node.js. View the front end here: https://github.com/jchue/disney-parks-client
disney-parks-api.vercel.app
0 stars 0 forks source link

Support data subdirectories #6

Closed jchue closed 3 years ago

jchue commented 3 years ago

Currently, all nodes reside in the data directory in a flat structure. As the number of nodes grows, this will become difficult to manage. Additionally, there could be different nodes with the same slug (e.g., peoplemover in the Tomorrowlands of both Disneyland and the Magic Kingdom). Enhance the build script to traverse a hierarchical data directory. This will probable also require rework of the output build directory as well as the API routes to mitigate the duplicate slugs.

jchue commented 3 years ago

With this solution, a node's slug will include its subdirectory path (e.g., disneyland-resort/disneyland/tomorrowland/star-tours) to maintain uniqueness. We will see if this is extensible.

To describe a node with children, use an index.md file in that node's directory. To describe a node without children, use that node's name as the file name. Example:

timeline
| node-without-children.md
└-node-with-children
  | index.md
  | child-node-without-children.md
  |
  └-child-node-with-children
      index.md
      sub-child-node-without-children.md