0

I have the following piece of code in Scala using Akka HTTP with Spray Routing

import akka.http.scaladsl.server.Directives._

val geoip =
path(RemainingPath) {remaining =>

  val response = . . .

  complete(response)
}

But the I get the error message

[ERROR] FreeGeoIp.scala:45: error: missing parameter type
[ERROR]     path(RemainingPath) {remaining =>
[ERROR]                          ^
[ERROR] one error found

Where exactly is the parameter type supposed to go?

The documentation on this is VERY poor, and according to the examples this code should work.

Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30

1 Answers1

1

Problem solved. I had too many imports with wildcards. When I reduced the wildcards the problem went away. This set of imports seems to work.

import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.Uri.apply
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport.sprayJsonUnmarshaller
import akka.http.scaladsl.marshalling.ToResponseMarshallable.apply
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.unmarshalling.Unmarshal

import akka.stream.scaladsl._

import scala.concurrent.Future

import spray.json._
import spray.json.DefaultJsonProtocol._
Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30