What problem does it solve?
This Skill streamlines the creation of RESTful API controllers in CFWheels, ensuring proper JSON responses, correct HTTP status codes, and robust API authentication. It automates the boilerplate for API development, allowing you to build reliable web services faster.
Core Features & Use Cases
- RESTful CRUD Actions: Generates
index, show, create, update, and delete actions tailored for API endpoints.
- JSON Response Handling: Ensures all API responses are correctly formatted as JSON with appropriate HTTP status codes (e.g., 200 OK, 201 Created, 404 Not Found).
- API Authentication: Implements API authentication filters to secure your endpoints, typically using bearer tokens.
- Use Case: Create a
/api/v1/posts endpoint. This skill generates the controller with all necessary CRUD actions, ensures JSON output, and protects it with an API authentication filter, allowing you to quickly expose your data securely.
Quick Start
In API controller:
function config() {
provides("json");
filters(through="requireApiAuth");
}
function index() {
renderWith(data=model("Resource").findAll(), format="json", status=200);
}