scala - Finch Hello World Error: Http not a member of com.twitter.finagle -


i'm trying use scala finch library build api.

i have following simple code:

package example  import io.finch._ import com.twitter.finagle.http  object helloworld extends app {    val api: endpoint[string] = get("hello") { ok("hello, world!") }    http.serve(":8080", api.toservice) } 

and build.sbt file looks this:

name := "hello-finch"  version := "1.0"  scalaversion := "2.10.6"  mainclass in (compile, run) := some("example.helloworld")  librarydependencies ++= seq(   "com.github.finagle" %% "finch-core" % "0.10.0" )  // found here: https://github.com/finagle/finch/issues/604 addcompilerplugin(   "org.scalamacros" % "paradise" % "2.1.0" cross crossversion.full ) 

when compile , run code error message:

object http not member of package com.twitter.finagle [error] import com.twitter.finagle.http [error]        ^ [error] /users/jamesk/code/hello_finch/hello-finch/src/main/scala/example/hello.scala:8: wrong number of type arguments io.finch.endpoint, should 2 [error]   val api: endpoint[string] = get("hello") { ok("hello, world!") } [error]            ^ [error] /users/jamesk/code/hello_finch/hello-finch/src/main/scala/example/hello.scala:8: not found: value [error]   val api: endpoint[string] = get("hello") { ok("hello, world!") } [error]                               ^ [error] /users/jamesk/code/hello_finch/hello-finch/src/main/scala/example/hello.scala:10: not found: value http [error]   http.serve(":8080", api.toservice) [error]   ^ [error] 4 errors found [error] (compile:compileincremental) compilation failed [error] total time: 1 s, completed aug 15, 2017 12:56:01 pm 

at point i'm running out of ideas, looks library it's pain getting working. appreciated.

i have updated example work last version of finch: "com.github.finagle" %% "finch-core" % "0.15.1" , scala 2.12

the build.sbt file:

name := "hello-finch"  version := "1.0"  scalaversion := "2.12.2"  mainclass in (compile, run) := some("example.helloworld")  librarydependencies ++= seq(   "com.github.finagle" %% "finch-core" % "0.15.1" ) 

then, src/main/scala/example/helloworld.scala file:

package example  import io.finch._ import com.twitter.finagle.http import com.twitter.util.await  object helloworld extends app {   val api: endpoint[string] = get("hello") { ok("hello, world!") }   await.ready(http.server.serve(":8080", api.toserviceas[text.plain])) } 

notice having await.ready() mandatory - program exit right away otherwise.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -