Lightning makes it easy to work with data. In this module, you create an Apex controller that allows your Lightning components to retrieve a list of accounts with their location information.
In Salesforce, click your name in the upper right corner of the screen. In the dropdown menu, click Developer Console.
In the Developer Console, click File > New > Apex Class. Specify AccountController as the class name and click OK.
Implement the class as follows:
public with sharing class AccountController {
@AuraEnabled
public static List<Account> findAll() {
return [SELECT id, name, Location__Latitude__s, Location__Longitude__s
FROM Account
WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL
LIMIT 50];
}
}
Click File > Save to save the file.