Browse Source

Add in code that was accidentally removed in merge conflict.

- Update import from EndpointProvider to HttpEndpointProvider
- Add back missing code from merge conflict in PR 1436
Brittany Mazza 10 năm trước cách đây
mục cha
commit
b048329807

+ 3 - 3
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala

@@ -1,7 +1,7 @@
 package scruffy.examples
 package scruffy.examples
 
 
 import com.mongodb.casbah.Imports._
 import com.mongodb.casbah.Imports._
-import com.sksamuel.scruffy.EndpointProvider
+import com.sksamuel.scruffy.HttpEndpointProvider
 import java.util.concurrent.ThreadLocalRandom
 import java.util.concurrent.ThreadLocalRandom
 
 
 /** @author Stephen Samuel */
 /** @author Stephen Samuel */
@@ -17,8 +17,8 @@ class Test2Endpoint() extends HttpEndpointProvider {
   //for ( k <- 1 to 10000 )
   //for ( k <- 1 to 10000 )
   //  collection.save(DBObject("_id" -> k, "id" -> k, "randomNumber" -> random.nextInt(10000).toDouble))
   //  collection.save(DBObject("_id" -> k, "id" -> k, "randomNumber" -> random.nextInt(10000).toDouble))
 
 
-  get("db").json {
-    req =>
+  get("db") { implicit req =>
+    json {
       val id = ThreadLocalRandom.current.nextInt(10000)
       val id = ThreadLocalRandom.current.nextInt(10000)
       val dbo = collection.findOne(DBObject("_id" -> id), fields)
       val dbo = collection.findOne(DBObject("_id" -> id), fields)
       val randomNumber = Math.round(dbo.get("randomNumber").toString.toFloat)
       val randomNumber = Math.round(dbo.get("randomNumber").toString.toFloat)