mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 20:50:24 +00:00
Elixir hello world example
This commit is contained in:
parent
ecb234693c
commit
b69903435e
8 changed files with 112 additions and 0 deletions
42
examples/elixir_hello_world/README.md
Normal file
42
examples/elixir_hello_world/README.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
Elixir Hello World
|
||||
==================
|
||||
|
||||
This is an example of running Cowboy with [Elixir](http://elixir-lang.org).
|
||||
|
||||
You need Elixir installed
|
||||
([instructions here](http://elixir-lang.org/getting_started/1.html))
|
||||
to run this example. After installing Elixir, you should have both
|
||||
`elixir` and `mix` executables available.
|
||||
|
||||
You also need [rebar](https://github.com/rebar/rebar) in your PATH
|
||||
to compile dependencies.
|
||||
|
||||
Then type the following command:
|
||||
|
||||
```
|
||||
mix deps.get
|
||||
```
|
||||
|
||||
The command above will fetch all dependencies and compile them.
|
||||
|
||||
You can then start the Erlang node with the following command:
|
||||
|
||||
```
|
||||
mix run --no-halt
|
||||
```
|
||||
|
||||
Then point your browser to localhost:8080.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
``` bash
|
||||
$ curl -i http://localhost:8080
|
||||
HTTP/1.1 200 OK
|
||||
connection: keep-alive
|
||||
server: Cowboy
|
||||
date: Fri, 28 Sep 2012 04:10:25 GMT
|
||||
content-length: 12
|
||||
|
||||
Hello world!
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue