stacks-api

Define and manage API endpoints for Stacks applications with route definitions and middleware.

622|17|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/stacksjs/stacks --skill stacks-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-api
Source: https://github.com/stacksjs/stacks/tree/main/.claude/skills/stacks-api
Command: npx skills add https://github.com/stacksjs/stacks --skill stacks-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Define, serve, and manage API endpoints for Stacks applications, including the utilities package and the stacks-api server, to streamline routing, middleware, and request handling.

Core Features & Use Cases

  • Core utilities: storage/framework/core/api/src/
  • API server: storage/framework/api/
  • Route definitions: routes/
  • Application routes: app/Routes.ts
  • Package: @stacksjs/api

Quick Start

Boot the stacks-api server and begin serving routes to handle API requests.

Frequently Asked Questions about stacks-api

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

FAQPage Schema
How do I define and manage API routes for a Stacks application using TypeScript?

To define API routes for a Stacks application, utilize the stacks-api server and @stacksjs/api utilities to manage route definitions, middleware, and server behavior. Routes are automatically loaded directly from the routes/ directory.

Does the stacks-api server support Bun and automated route loading?

Yes, the stacks-api server supports Bun and TypeScript compatibility while providing automated route loading. It automatically discovers and serves endpoints by loading route definitions directly from the routes/ directory.

How do I set up middleware and request handling for Stacks API endpoints?

You set up middleware and request handling for Stacks API endpoints by utilizing the @stacksjs/api utilities package alongside the stacks-api server. This combination streamlines request processing and route management across your application.

What is the best way to serve API endpoints in a Bun TypeScript environment?

The best way to serve API endpoints in a Bun TypeScript environment is booting the stacks-api server. It handles frontmatter-driven discovery and automatically serves your defined routes to process incoming API requests efficiently.

Can I use application routes in app/Routes.ts alongside automated route loading?

Yes, you can use application routes defined in app/Routes.ts alongside automated route loading from the routes/ directory. The stacks-api server processes both to comprehensively serve your API endpoints.

Why are my Stacks API endpoints not loading from the routes/ directory?

If Stacks API endpoints are not loading, verify your route definitions are correctly placed in the routes/ directory and that the stacks-api server is properly booted. The server relies on automated loading from this specific directory structure.