Created
June 12, 2019 09:22
-
-
Save aeons/5077622a25f158c66b29e086b04009b2 to your computer and use it in GitHub Desktop.
Save the input file with ISO-8859-1 encoding and then run `curl -X POST -d @input --header "Content-Type: application/xml; charset=ISO-8859-1" http://localhost:3000`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
áéíóú |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import cats.effect.{ExitCode, IO, IOApp} | |
import cats.implicits._ | |
import org.http4s.HttpRoutes | |
import org.http4s.dsl.Http4sDsl | |
import org.http4s.implicits._ | |
import org.http4s.server.blaze.BlazeServerBuilder | |
object Main extends IOApp with Http4sDsl[IO] { | |
def run(args: List[String]): IO[ExitCode] = | |
BlazeServerBuilder[IO] | |
.bindHttp(3000, "localhost") | |
.withHttpApp(testService.orNotFound) | |
.resource | |
.use(_ => IO.never) | |
.as(ExitCode.Success) | |
val testService = HttpRoutes.of[IO] { | |
case req @ POST -> Root => | |
req.as[String].flatMap(Ok(_)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment