egg-controller

Develop HTTP, MCP, and Schedule controllers for Egg.js applications.

19.0k|1.8k|Updated Jun 18, 2016
One-click install
npx skills add https://github.com/eggjs/egg --skill egg-controller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: egg-controller
Source: https://github.com/eggjs/egg/tree/main/packages/skills/egg-controller
Command: npx skills add https://github.com/eggjs/egg --skill egg-controller

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the creation of API endpoints, protocol handlers, and interfaces for Egg.js applications, enabling developers to expose functionality efficiently.

Core Features & Use Cases

  • HTTP Controllers: Define RESTful APIs, webhooks, and server-sent event endpoints.
  • MCP Controllers: Integrate Large Language Models (LLMs) for conversational interfaces and tool execution.
  • Schedules: Implement cron jobs and recurring tasks for background processing.
  • Use Case: Develop a backend API for a web application, exposing endpoints for user management, data retrieval, and real-time updates using HTTP Controllers, while also setting up a daily data aggregation task with Schedules.

Quick Start

Use the egg-controller skill to create a new HTTP endpoint that accepts a GET request at '/users/:id' and returns the user's details.

Frequently Asked Questions about egg-controller

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

FAQPage Schema
How do I create RESTful APIs in an Egg.js application?

You create RESTful APIs in an Egg.js application by using HTTP Controllers with decorators for routing, parameter binding, and request handling. This approach defines endpoints for webhooks and server-sent events efficiently.

Can I integrate Large Language Models into an Egg.js backend?

Yes, you can integrate Large Language Models into an Egg.js backend using MCP Controllers. They facilitate LLM integration for conversational interfaces and tool execution directly within your application.

How do I schedule cron jobs and recurring tasks in Egg.js?

You schedule cron jobs and recurring tasks in Egg.js using the Schedule controller type. This feature implements background processing for recurring tasks like daily data aggregation within your application.

Does Egg.js controller development support TypeScript and schema validation?

Egg.js controller development supports TypeScript and schema validation via Zod. Decorators handle parameter binding and schema validation to ensure type safety and correct request data formatting.

What is the best way to expose functionality and protocol handlers in Egg.js?

The best way to expose functionality and protocol handlers in Egg.js is by using specialized controller decorators. They simplify endpoint creation across HTTP, MCP, and Schedule protocols for efficient service exposure.