Skip to content

Latest commit

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

README.md

Examples

This directory contains practical examples demonstrating various features of ewe.

To run an example, use the following command:

gleam run -m <example name>

For example, to run the getting started example:

gleam run -m getting_started

Examples

Here is a list of all the examples:

  • getting_started - Basic HTTP server with "Hello, World!" response
  • sending_response - Different response body types (text, binary, empty)
  • reading_body - Reading and echoing request bodies with size limits
  • streaming_bodies - Streaming large request/response bodies in chunks
  • serving_files - Serving static files from disk
  • client_info - Reading the address a request came from
  • websocket - WebSocket connections with topic-based pubsub
  • sse - Server-Sent Events for real-time server-to-client updates

The websocket and sse examples share pubsub, a small topic based broadcaster. It is not an example itself, it is kept out of the handlers so they stay about ewe's API.