miolo-routing

Define consistent API routing patterns for miolo apps under src/server/routes.

Updated Feb 4, 2022
One-click install
npx skills add https://github.com/afialapis/miolo --skill miolo-routing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: miolo-routing
Source: https://github.com/afialapis/miolo/tree/main/skills/miolo-routing
Command: npx skills add https://github.com/afialapis/miolo --skill miolo-routing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardized API routing patterns reduce the complexity of wiring endpoints, ensure consistent route organization, and simplify maintenance across miolo applications.

Core Features & Use Cases

  • Route Organization: Routes are organized under src/server/routes by domain/feature with a standard file structure and registration flow.
  • Route Registration Pattern: Single export of default route arrays, with groups containing prefix and routes, and each route specifying method, url, auth, and callback.
  • Creating Route Handlers & Validation: Handlers follow the r_ prefix conventions, access request data, and optionally validate inputs with Joi.
  • Authentication & Security: Supports per-route authentication settings and consistent user context usage.
  • Multi-file Organization & Best Practices: Encourages modular route organization across files and adherence to conventions, logging, and error handling.

Quick Start

Create and wire up a new API route by following the standard miolo routing pattern in src/server/routes.

Frequently Asked Questions about miolo-routing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize API routes in a miolo application?

API routing in miolo is organized by domain or feature under the src/server/routes directory using a standard file structure and a single registration flow in routes/index.mjs.

How do I validate request data in miolo route handlers?

Route handlers in miolo can optionally validate inputs using Joi, following the r_ prefix convention to ensure consistent access to request data and secure routing.

Can I apply authentication to individual API routes in miolo?

Yes, miolo routing supports per-route authentication settings, allowing you to specify the auth parameter on each route to ensure secure user context and endpoint protection.

What is the best way to scale route registration across multiple files in miolo?

The best way to scale miolo routing is using a single export of default route arrays containing groups with prefixes and routes, encouraging modular organization across multiple files.

How does miolo handle error logging for API endpoints?

Miolo routing enforces consistent logging practices and standard error handling conventions across all route callbacks to ensure maintainable and secure API endpoints.