Try ExecutionContext (for Futures) and/or FlowMaterializer (for marshalling).
See 
https://github.com/hseeberger/reactive-flows/blob/master/src/main/scala/de/heikoseeberger/reactiveflows/HttpService.scala#L51
 
<https://github.com/hseeberger/reactive-flows/blob/master/src/main/scala/de/heikoseeberger/reactiveflows/HttpService.scala#L51>

Heiko

--

Heiko Seeberger
Home: heikoseeberger.de <http://heikoseeberger.de/>
Twitter: @hseeberger <https://twitter.com/hseeberger>
Public key: keybase.io/hseeberger <https://keybase.io/hseeberger>
> On 20 Jun 2015, at 04:11, Nicolau Werneck <[email protected]> wrote:
> 
> I am writing an application where I have different types of entities. I wrote 
> a generic DAO object with Slick to perform basic CRUD operations, and I want 
> to create routes to make a simples http service for these entities. I have 
> similar routes, so I wanted to write a function for a generic CRUD routes.
> 
> Now the problem is, I can assign part of a route to a `val` and then put that 
> in the route definition like a directive. But if I use a `def` in order to 
> write a function to take parameters and write each specific route, with type 
> parameters, it doesn't work. I get an error like:
> 
> Error:(33, 18) type mismatch;
>  found   : scala.concurrent.Future[Option[E]]
>  required: akka.http.scaladsl.marshalling.ToResponseMarshallable
>           dao.get(elementId)
>                  ^
> 
> I suppose it might be the need for some implicit parameter, I don't know. Any 
> hints?
> 
>     ++nic
> 
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <https://groups.google.com/group/akka-user>
> ---
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to