mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Rename example 'static' to 'static_world' to avoid confusion
This commit is contained in:
parent
eaaa81cce6
commit
f96e20aef7
12 changed files with 13 additions and 13 deletions
|
@ -25,8 +25,8 @@ Cowboy Examples
|
||||||
* [rest_hello_world](./examples/rest_hello_world):
|
* [rest_hello_world](./examples/rest_hello_world):
|
||||||
return the data type that matches the request type (ex: html, text, json)
|
return the data type that matches the request type (ex: html, text, json)
|
||||||
|
|
||||||
* [static](./examples/static):
|
* [static_world](./examples/static_world):
|
||||||
an example file server
|
static file handler
|
||||||
|
|
||||||
* [websocket](./examples/websocket):
|
* [websocket](./examples/websocket):
|
||||||
websocket example
|
websocket example
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Cowboy Static Files Server
|
Cowboy Static File Handler
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
To compile this example you need rebar in your PATH.
|
To compile this example you need rebar in your PATH.
|
|
@ -1,7 +1,7 @@
|
||||||
%% Feel free to use, reuse and abuse the code in this file.
|
%% Feel free to use, reuse and abuse the code in this file.
|
||||||
|
|
||||||
{application, static, [
|
{application, static_world, [
|
||||||
{description, "Cowboy static file server example."},
|
{description, "Cowboy static file handler example."},
|
||||||
{vsn, "1"},
|
{vsn, "1"},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
|
@ -10,6 +10,6 @@
|
||||||
stdlib,
|
stdlib,
|
||||||
cowboy
|
cowboy
|
||||||
]},
|
]},
|
||||||
{mod, {static_app, []}},
|
{mod, {static_world_app, []}},
|
||||||
{env, []}
|
{env, []}
|
||||||
]}.
|
]}.
|
|
@ -1,6 +1,6 @@
|
||||||
%% Feel free to use, reuse and abuse the code in this file.
|
%% Feel free to use, reuse and abuse the code in this file.
|
||||||
|
|
||||||
-module(static).
|
-module(static_world).
|
||||||
|
|
||||||
%% API.
|
%% API.
|
||||||
-export([start/0]).
|
-export([start/0]).
|
||||||
|
@ -11,4 +11,4 @@ start() ->
|
||||||
ok = application:start(crypto),
|
ok = application:start(crypto),
|
||||||
ok = application:start(ranch),
|
ok = application:start(ranch),
|
||||||
ok = application:start(cowboy),
|
ok = application:start(cowboy),
|
||||||
ok = application:start(static).
|
ok = application:start(static_world).
|
|
@ -1,7 +1,7 @@
|
||||||
%% Feel free to use, reuse and abuse the code in this file.
|
%% Feel free to use, reuse and abuse the code in this file.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
-module(static_app).
|
-module(static_world_app).
|
||||||
-behaviour(application).
|
-behaviour(application).
|
||||||
|
|
||||||
%% API.
|
%% API.
|
||||||
|
@ -14,7 +14,7 @@ start(_Type, _Args) ->
|
||||||
Dispatch = cowboy_router:compile([
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{"/[...]", cowboy_static, [
|
{"/[...]", cowboy_static, [
|
||||||
{directory, {priv_dir, static, []}},
|
{directory, {priv_dir, static_world, []}},
|
||||||
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
|
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
|
||||||
]}
|
]}
|
||||||
]}
|
]}
|
||||||
|
@ -22,7 +22,7 @@ start(_Type, _Args) ->
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
static_sup:start_link().
|
static_world_sup:start_link().
|
||||||
|
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
ok.
|
ok.
|
|
@ -1,7 +1,7 @@
|
||||||
%% Feel free to use, reuse and abuse the code in this file.
|
%% Feel free to use, reuse and abuse the code in this file.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
-module(static_sup).
|
-module(static_world_sup).
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
|
|
||||||
%% API.
|
%% API.
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
erl -pa ebin deps/*/ebin -s static \
|
erl -pa ebin deps/*/ebin -s static_world \
|
||||||
-eval "io:format(\"Point your browser at http://localhost:8080/test.txt~n\")." \
|
-eval "io:format(\"Point your browser at http://localhost:8080/test.txt~n\")." \
|
||||||
-eval "io:format(\"Point your browser at http://localhost:8080/video.html~n\")."
|
-eval "io:format(\"Point your browser at http://localhost:8080/video.html~n\")."
|
Loading…
Add table
Add a link
Reference in a new issue