+ Start a Discussion
Amy S. OplingerAmy S. Oplinger 

Create Server-side Apex Controller Class - ERROR please help!

Trying to verify the first step of 
Quick Start: Lightning ComponentsCreate a Server-side Apex Controller Class and get the following error: Please advise. Thanks!

User-added image
Actually, you need to place that code inside the class. 
For eg. 
public with sharing class MyContactListController{
    public static List<contact> getContacts() {

        // Perform isAccessible() checks here 
        return [SELECT Id, Name  FROM contact];

Please try to save above class and mark this as answer if it helps you.
Terimarie DegreeTerimarie Degree
thanks, i was making the same mistake!
Gary O'NeillGary O'Neill
Same, thanks! Stupid mistake, but easy to do when you think, "Eh just copy paste this in".
Segvan JohnsonSegvan Johnson
here is a full correct code,
public class MyContactListController {
public static List<Contact> getContacts(Id recordId) {
   return [Select Id, FirstName, LastName, Email, Phone From Contact Where AccountId = :recordId];