Use Apex to write
server-side code, such as controllers and test classes.
Server-side controllers handle requests from client-side controllers. For example, a client-side controller might handle an event and call a server-side
controller action to persist a record. A server-side controller can also load your record data.
Creating Server-Side Logic with Controllers
The framework supports client-side and server-side controllers. An event is always wired to a client-side controller action, which can in turn call a server-side controller action. For example, a client-side controller might handle an event and call a server-side controller action to persist a record.
Testing Your Apex Code
Before you can upload a managed package, you must write and execute tests for your Apex code to meet minimum code coverage requirements. Also, all tests must run without errors when you upload your package to AppExchange.
Making API Calls from Apex
Make API calls from an Apex controller. You can’t make Salesforce API calls from JavaScript code.
Creating Components in Apex
Creating components on the server side in Apex, using the Cmp.<myNamespace>.<myComponent> syntax, is deprecated. Use $A.createComponent() in client-side JavaScript code instead.