@api Decorator
How do I use the @api decorator?
How do I use the @api decorator?
Attach the Auto-generated endpoints:
@api decorator to Model or Frame class methods to create REST API endpoints.Basic usage:What are the options for @api decorator?
What are the options for @api decorator?
httpMethod (required):guards (authentication/authorization):path (custom path):
Creating Public APIs: Omit the
guards option to create a public API accessible to anyone without authentication. Use this for endpoints that don’t require login or permission checks.How do I receive parameters in GET requests?
How do I receive parameters in GET requests?
Query parameters (single values):Query parameters (object):
How do I receive body in POST requests?
How do I receive body in POST requests?
Single object:Multiple parameters:
How do I create a file upload API?
How do I create a file upload API?
Single file:Multiple files:
How do I return errors?
How do I return errors?
BadRequestException (400):UnauthorizedException (401):Permission error (403):NotFoundException (404):
Context and Session
How do I get current logged-in user information?
How do I get current logged-in user information?
What information is in Context?
What information is in Context?
How do I use sessions?
How do I use sessions?
Session configuration:Save session:Read session:Delete session:
Authentication and Authorization
How do I control permissions with Guards?
How do I control permissions with Guards?
Guard configuration:Using Guards:
Response Format
How do I customize API responses?
How do I customize API responses?
Default response:Custom response:Setting headers:
How do I return paginated responses?
How do I return paginated responses?
Using ListResult:
Frontend Integration
How do I use auto-generated client code?
How do I use auto-generated client code?
Service files auto-generated:When Model files change, Using in React:Using TanStack Query hooks:
{entity}.service.ts is auto-generated.