๐Ÿ• ๐Ÿ’

Buddy's General Care - nested

Basic pet care activity

Rest Parameter Route

File: [...activity].astro
Full URL: /pets/dog/buddy/care/deep/nested/path/example
Activity path: "deep/nested/path/example" โ†’ ["deep", "nested", "path", "example"]
Parsed as: Activity: "deep", Sub-activity: "nested"

Activity Steps

1

Assess pet needs

2

Prepare necessary items

3

Perform care activity

4

Monitor results

Try These URLs

Click these buttons to explore different care activities, or create your own URL below:

Create Your Own URL

The rest parameter [...activity] can handle any path depth. Try creating your own URL:

Examples to try:
โ€ข feeding/dinner/special-diet
โ€ข grooming/full-service/nail-trimming/front-paws
โ€ข playing/outdoor/park/fetch/tennis-ball

Activity Status

โฐ
Started
Just now
๐Ÿ“Š
Progress
In progress
๐Ÿ’
Pet Mood
Happy

Rest Parameter Implementation

---
// File: /pets/[species]/[name]/care/[...activity].astro
const { species, name, activity } = Astro.params;

// Parse rest parameter into parts
const activityPath = activity || '';
const activityParts = activityPath.split('/').filter(Boolean);
const currentActivity = activityParts[0] || 'general';
const subActivity = activityParts[1] || null;

// This route matches:
// /pets/dog/buddy/care/feeding
// /pets/dog/buddy/care/feeding/breakfast
// /pets/dog/buddy/care/grooming/brushing
// /pets/dog/buddy/care/any/deep/nested/path
---

<h1>{pet.name}'s {currentActivity}</h1>

Try These URLs

/pets/dog/buddy/care/feeding โ†’ Basic feeding activity
/pets/dog/buddy/care/feeding/breakfast โ†’ Specific meal time
/pets/dog/buddy/care/training/sit โ†’ Specific training command