[erlang-questions] Cowboy static file handler example
lloyd@REDACTED
lloyd@REDACTED
Sun Apr 27 19:53:54 CEST 2014
Hi Ahmad,
I'm using the route config show in static_world_app:start/2; e.g.:
start(_Type, _Args) ->
Dispatch = cowboy_router:compile([
{'_', [
{"/[...]", cowboy_static, {priv_dir, static_world, "",
[{mimetypes, cow_mimetypes, all}]}}
]}
]),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{env, [{dispatch, Dispatch}]}
]),
static_world_sup:start_link().
Many thanks for your help.
Lloyd
-----Original Message-----
From: "Ahmad Baitalmal" <ahmad@REDACTED>
Sent: Sunday, April 27, 2014 1:32pm
To: lloyd@REDACTED
Cc: "Erlang Questions" <erlang-questions@REDACTED>
Subject: Re: [erlang-questions] Cowboy static file handler example
Could you please post your cowboy route config.
______________
Ahmad Baitalmal
CEO & Co-Founder
BitBuilder.com
650.539.9401
On Apr 25, 2014, at 10:53 AM, lloyd@REDACTED wrote:
> Hello,
>
> The Cowboy static file handler example contains two demos: plain text file and HTML5 video. The plain text file demo works fine on my system; HTML5 video demo returns a blank screen.
>
> In effort to understand why, I created a plain-vanilla HTML file with a single headline tag. This also returned a blank screen.
>
> Evidently the server can't find the *.html file in the priv dir:
>
> lloyd@REDACTED:~$ curl -i http://localhost:8080/test.html
> HTTP/1.1 404 Not Found
> connection: keep-alive
> server: Cowboy
> date: Fri, 25 Apr 2014 17:48:57 GMT
> content-length: 0
> content-type: text/html
>
> -rw-rw-r-- 1 lloyd lloyd 383631 Apr 25 13:23 small.mp4
> -rw-rw-r-- 1 lloyd lloyd 872453 Apr 25 13:24 small.ogv
> -rw-rw-r-- 1 lloyd lloyd 84 Apr 25 13:48 test.html
> -rw-rw-r-- 1 lloyd lloyd 52 Apr 25 12:52 test.txt
> -rw-rw-r-- 1 lloyd lloyd 19753 Apr 25 13:17 tree.jpg
> -rw-rw-r-- 1 lloyd lloyd 106622 Apr 25 13:16 tree.png
> -rw-rw-r-- 1 lloyd lloyd 315 Apr 25 13:24 video.html
>
> If I list the priv dir, test.html shows up, as does test.txt. But the server finds test.txt, but not test.html.
>
> Am I doing something wrong? Or is there a problem with the Cowboy example code?
>
> Thanks,
>
> LRP
>
>
>
> *********************************************
> My books:
>
> THE GOSPEL OF ASHES
> http://thegospelofashes.com
>
> Strength is not enough. Do they have the courage
> and the cunning? Can they survive long enough to
> save the lives of millions?
>
> FREEIN' PANCHO
> http://freeinpancho.com
>
> A community of misfits help a troubled boy find his way
>
> AYA TAKEO
> http://ayatakeo.com
>
> Star-crossed love, war and power in an alternative
> universe
>
> Available through Amazon or by request from your
> favorite bookstore
>
>
> **********************************************
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list