mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Convert the cookie example to a release
This commit is contained in:
parent
2f25c654b0
commit
340f0a5112
7 changed files with 34 additions and 37 deletions
15
examples/cookie/Makefile
Normal file
15
examples/cookie/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
PROJECT = cookie
|
||||||
|
|
||||||
|
DEPS = cowboy erlydtl
|
||||||
|
dep_cowboy = pkg://cowboy master
|
||||||
|
dep_erlydtl = pkg://erlydtl master
|
||||||
|
|
||||||
|
.PHONY: release clean-release
|
||||||
|
|
||||||
|
release: clean-release all
|
||||||
|
relx
|
||||||
|
|
||||||
|
clean-release:
|
||||||
|
rm -rf _rel
|
||||||
|
|
||||||
|
include ../../erlang.mk
|
|
@ -1,18 +1,21 @@
|
||||||
Cowboy Cookie
|
Cookie example
|
||||||
=============
|
==============
|
||||||
|
|
||||||
To compile this example you need rebar in your PATH.
|
To try this example, you need GNU `make`, `git` and
|
||||||
|
[relx](https://github.com/erlware/relx) in your PATH.
|
||||||
|
|
||||||
Type the following command:
|
To build the example, run the following command:
|
||||||
```
|
|
||||||
$ rebar get-deps compile
|
``` bash
|
||||||
|
$ make
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then start the Erlang node with the following command:
|
To start the release in the foreground:
|
||||||
```
|
|
||||||
./start.sh
|
``` bash
|
||||||
|
$ ./_rel/bin/cookie_example console
|
||||||
```
|
```
|
||||||
|
|
||||||
Then point your browser to the indicated URL. This example allows
|
Then point your browser at [http://localhost:8080](http://localhost:8080).
|
||||||
you to use any path you want to try to show that cookies are defined
|
This example allows you to use any path to show that the cookies
|
||||||
site-wide. Try it in your browser!
|
are defined site-wide. Try it!
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{deps, [
|
|
||||||
{cowboy, ".*",
|
|
||||||
{git, "git://github.com/extend/cowboy.git", "master"}},
|
|
||||||
{erlydtl, ".*",
|
|
||||||
{git, "https://github.com/evanmiller/erlydtl.git", "master"}}
|
|
||||||
]}.
|
|
2
examples/cookie/relx.config
Normal file
2
examples/cookie/relx.config
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{release, {cookie_example, "1"}, [cookie]}.
|
||||||
|
{extended_start_script, true}.
|
|
@ -8,7 +8,8 @@
|
||||||
{applications, [
|
{applications, [
|
||||||
kernel,
|
kernel,
|
||||||
stdlib,
|
stdlib,
|
||||||
cowboy
|
cowboy,
|
||||||
|
erlydtl
|
||||||
]},
|
]},
|
||||||
{mod, {cookie_app, []}},
|
{mod, {cookie_app, []}},
|
||||||
{env, []}
|
{env, []}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
%% Feel free to use, reuse and abuse the code in this file.
|
|
||||||
|
|
||||||
-module(cookie).
|
|
||||||
|
|
||||||
%% API.
|
|
||||||
-export([start/0]).
|
|
||||||
|
|
||||||
%% API.
|
|
||||||
|
|
||||||
start() ->
|
|
||||||
ok = application:start(crypto),
|
|
||||||
ok = application:start(cowlib),
|
|
||||||
ok = application:start(ranch),
|
|
||||||
ok = application:start(cowboy),
|
|
||||||
ok = application:start(cookie).
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
erl -pa ebin deps/*/ebin -s cookie \
|
|
||||||
-eval "io:format(\"Point your browser at http://localhost:8080~n\")."
|
|
Loading…
Add table
Add a link
Reference in a new issue