Packages
relay_supervisor
1.0.0-rc1
A supervisor where older children can pass data to younger children!
Current section
Files
Jump to
Current section
Files
relay_supervisor
README.md
README.md
# relay_supervisor
A supervisor where older children can pass data to younger children!
[](https://hex.pm/packages/relay_supervisor)
[](https://relay-supervisor.hexdocs.pm/)
This is useful any time a child needs to make use of another. For example, if
you have a web server that uses a database connection.
```sh
gleam add relay_supervisor@1
```
```gleam
import relay_supervisor as relay
fn start(credentials: String, hostname: String) -> _ {
relay.new(fn(children) {
children
|> relay.add(
relay.child(database.template)
|> relay.providing(fn(_state) { credentials })
|> relay.returning(fn(_state, db) { db })
)
|> relay.add(
relay.child(web_server.template)
|> relay.providing(fn(db) { #(db, hostname) })
)
})
}
```
See [HexDocs](https://relay-supervisor.hexdocs.pm/) for an explanation of this
code and for further documentation.