0

I am new to Scala and to akka i am trying to publish endpoint. Following compilation error is occurring.

 found: akka.http.scaladsl.server.StandardRoute
 [error]  required: scala.util.Try[Option[com.activegrid.entities.AuthSettings]] => (akka.http.scaladsl.server.RequestContext => scala.concurrent.Future[akka.http.scaladsl.server.RouteResult])

Case class

case class AuthSettings(authType:String,authLevel:String,scope:String);

Enpoint

pathPrefix("config") {
       path("settings"/"auth") {
         post {
           entity(as[AuthSettings]) { authSettings =>
             val save: Future[AuthSettings] = persistance.persistAuthSettings(authSettings)
             onComplete(save) {
               complete("To insert app settings")
             }
           }
         }
       }

persistAuthSettings definition

def persistAuthSettings(authSettings: AuthSettings) : Future[AuthSettings] = Future {
    //Neo4j Operations
    authSettings;

}

What is going wrong in my code?

Siva Kumar
  • 632
  • 3
  • 9
  • 19

1 Answers1

1

onComplete extracts the value from the future, and requires a function which operates on this value:

onComplete(save) { appSettings =>
  complete("To insert app settings")
}
devkat
  • 1,624
  • 14
  • 15