Apex サーバ側コントローラの概要
サーバ側コントローラを Apex で作成し、@AuraEnabled アノテーションを使用して、クライアント側からもサーバ側からもコントローラメソッドにアクセスできるようにします。
@AuraEnabled を使用して明示的にアノテーションを付加したメソッドのみが公開されます。
次の Apex コントローラには、渡される値の先頭に文字列を付加する serverEcho アクションが含まれます。
1public with sharing class SimpleServerSideController {
2
3 //Use @AuraEnabled to enable client- and server-side access to the method
4 @AuraEnabled
5 public static String serverEcho(String firstName) {
6 return ('Hello from the server, ' + firstName);
7 }
8}