Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions client.mojo

This file was deleted.

15 changes: 15 additions & 0 deletions examples/echo_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Echo Server

A simple echo server example using `lightbug_http` for the server and `floki` for the client. The server listens for incoming HTTP requests and responds with the same body and content type.

To run the server, execute the following command in the terminal:

```bash
pixi run server
```

In a separate terminal, you can run the client to send a request to the server:

```bash
pixi run client
```
17 changes: 17 additions & 0 deletions examples/echo_server/client.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import floki


fn main() raises:
var response = floki.post(
"localhost:8080",
headers={"Content-Type": "text/plain"},
data="Hello, Echo Server!".as_bytes()
)
print(response.body.as_string_slice())

response = floki.post(
"localhost:8080",
headers={"Content-Type": "application/json"},
data={"message": "Hello, Echo Server!"}
)
print(response.body.as_json())
Loading
Loading