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.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public with sharing class SimpleServerSideController {
18
19 //Use @AuraEnabled to enable client- and server-side access to the method
20 @AuraEnabled
21 public static String serverEcho(String firstName) {
22 return ('Hello from the server, ' + firstName);
23 }
24}