dotnet / WatsonWebserver

Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
MIT License
406 stars 83 forks source link

Need code sample for localhost http echo server. #55

Closed zydjohnHotmail closed 3 years ago

zydjohnHotmail commented 3 years ago

Hello: I need a simple http echo server, which can accept localhost http post data, and show the data posted by http client. I looked at your repo., and found it rather complicated. Can you provide a simple http echo server code sample? By the way, I am using Visual Studio 2019 version 16.9.0 targeting .net 5 on Windows 10. Thanks,

jchristn commented 3 years ago

Hi @zydjohnHotmail just set a route and then:

await ctx.Response.Send(ctx.Request.DataAsString());

or

await ctx.Response.Send(ctx.Request.DataAsBytes());