Newer Version Available
Apex Server-Side Controller Overview
Create a server-side controller in Apex and use the @AuraEnabled annotation to enable client- and
server-side access to the controller method.
Only methods that you have explicitly annotated with @AuraEnabled are exposed.
This Apex controller contains a serverEcho action that prepends a string to the value passed in.
In addition to using the @AuraEnabled annotation,
your Apex controller
must follow these requirements.
- Methods must be static and marked public or global. Non-static methods are not supported.
- If a method returns an object, instance methods that retrieve the value of the object’s instance field must be public.
For more information, see Understanding Classes in the Apex Code Developer's Guide.