I currently learning the basics of RESTFUL API, with Play and am getting issues: am following some longtime tutorial and think am failing with right scala syntax! need help, thanks
here is the error…
package controllers
import play.api.libs.json.Json
import javax.inject.Inject
import play.api.Configuration
import play.api.mvc.{AbstractController, ControllerComponents}
import scala.concurrent.ExecutionContext
class PlacesController @Inject()(cc: ControllerComponents)(implicit assetsFinder: AssetsFinder, ec: ExecutionContext, configuration: Configuration)
extends AbstractController(cc) {
case class PlacesController(id: Int, name: String)
val thePlaces: List = List(
thePlaces(1, "newyork"),
thePlaces(2, "chicago"),
thePlaces(3, "capetown")
)
implicit val thePlacesWrites = Json.writes[PlacesController]
def listPlaces = Action {
val json = Json.toJson(thePlaces)
Ok(json)
}
}