Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Schaefermeyer committed Jan 22, 2016
1 parent 34cd34e commit 23b783f
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 3 deletions.
111 changes: 111 additions & 0 deletions doc/changelog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.11.3">
<title>Changelog – cors_plug v1.0.0</title>
<link rel="stylesheet" href="dist/app-ddd9717ad9.css" />
<script src="dist/sidebar_items.js"></script>
</head>
<body data-type="extras">

<div class="main">
<button class="sidebar-toggle">
<i class="icon-menu"></i>
</button>
<section class="sidebar">
<button class="sidebar-toggle">
<i class="icon-menu"></i>
</button>


<a href="api-reference.html" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
cors_plug
</h1>
<h2 class="sidebar-projectVersion">
v1.0.0
</h2>
</div>

</a>

<div class="sidebar-search">
<i class="icon-search"></i>
<input type="text" class="sidebar-searchInput" placeholder="search" autocomplete="off" />
</div>

<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>


<li><a id="modules-list" href="#full-list">Modules</a></li>





</ul>

<ul id="full-list" class="sidebar-fullList"></ul>
<div class="sidebar-noResults"></div>
</section>

<section class="content">
<div id="content" class="content-inner">


<h1>Changelog</h1>
<h2 id="v1-0-0"> v1.0.0</h2><ul>
<li>Fixes
</li>
<li>Don’t override headers. Earlier headers would’ve been overriden by the
CORS Plug. Amazing that this hasn’t popped up before…
</li>
</ul>
<p>As this makes a backward-incompatible change (no longer overriding headers
this is a new major).</p>
<h2 id="v0-1-4"> v0.1.4</h2><ul>
<li>Enhancements
</li>
<li>Add <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Expose-Headers"><code class="inline">Access-Control-Expose-Headers</code></a> (thanks @jaketrent)
</li>
</ul>
<h2 id="v0-1-3"> v0.1.3</h2><ul>
<li>Enhancements
</li>
<li>Add license
</li>
<li>Improve readme (thanks @leighhalliday, @patricksrobertson)
</li>
<li>Simplify travis.yml (thanks @lowks)
</li>
</ul>
<h2 id="v-0-1-2"> v.0.1.2</h2><ul>
<li>Release plug dependency
</li>
</ul>

<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.11.3),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
<button class="night-mode-toggle" />
</footer>
</div>
</section>
</div>
<script src="dist/app-6d2e071366.js"></script>
</body>
</html>

2 changes: 1 addition & 1 deletion doc/dist/sidebar_items.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 149 additions & 0 deletions doc/readme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.11.3">
<title>README – cors_plug v1.0.0</title>
<link rel="stylesheet" href="dist/app-ddd9717ad9.css" />
<script src="dist/sidebar_items.js"></script>
</head>
<body data-type="extras">

<div class="main">
<button class="sidebar-toggle">
<i class="icon-menu"></i>
</button>
<section class="sidebar">
<button class="sidebar-toggle">
<i class="icon-menu"></i>
</button>


<a href="api-reference.html" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
cors_plug
</h1>
<h2 class="sidebar-projectVersion">
v1.0.0
</h2>
</div>

</a>

<div class="sidebar-search">
<i class="icon-search"></i>
<input type="text" class="sidebar-searchInput" placeholder="search" autocomplete="off" />
</div>

<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>


<li><a id="modules-list" href="#full-list">Modules</a></li>





</ul>

<ul id="full-list" class="sidebar-fullList"></ul>
<div class="sidebar-noResults"></div>
</section>

<section class="content">
<div id="content" class="content-inner">


<h1>CorsPlug</h1>
<p><a href="https://travis-ci.org/mschae/cors_plug"><img src="https://travis-ci.org/mschae/cors_plug.svg" alt="Build Status"/></a></p>
<p>An <a href="http://github.com/elixir-lang/plug">Elixir Plug</a> to add <a href="http://www.w3.org/TR/cors/">CORS</a>.</p>
<h2 id="Usage"> Usage</h2><ol>
<li>Add this plug to your <code class="inline">mix.exs</code> dependencies:
</li>
</ol>
<pre><code class="elixir">def deps do
# ...
{:cors_plug, &quot;~&gt; 0.1.4&quot;},
#...
end</code></pre>
<p>When used together with the awesomeness that’s the <a href="http://www.phoenixframework.org/">Phoenix Framework</a>
please note that putting the CORSPlug in a pipeline won’t work as they are only invoked for
matched routes.</p>
<p>I therefore recommend to put it in <code class="inline">lib/your_app/endpoint.ex</code>:</p>
<pre><code class="elixir">defmodule YourApp.Endpoint do
use Phoenix.Enpoint, otp_app: :your_app

# ...
plug CORSPlug

plug YourApp.Router
end</code></pre>
<p>Alternatively you can add options routes, as suggested by @leighhalliday</p>
<pre><code class="elixir">scope &quot;/api&quot;, PhoenixApp do
pipe_through :api

resources &quot;/articles&quot;, ArticleController
options &quot;/articles&quot;, ArticleController, :options
options &quot;/articles/:id&quot;, ArticleController, :options
end</code></pre>
<h2 id="Configuration"> Configuration</h2><p>This plug will return the following headers:</p>
<p>On preflight (<code class="inline">OPTIONS</code>) requests:</p>
<ul>
<li>Access-Control-Allow-Origin
</li>
<li>Access-Control-Allow-Credentials
</li>
<li>Access-Control-Max-Age
</li>
<li>Access-Control-Allow-Headers
</li>
<li>Access-Control-Allow-Methods
</li>
</ul>
<p>On <code class="inline">GET</code>, <code class="inline">POST</code>, … requests:</p>
<ul>
<li>Access-Control-Allow-Origin
</li>
<li>Access-Control-Expose-Headers
</li>
<li>Access-Control-Allow-Credentials
</li>
</ul>
<p>You can configure the value of these headers as follows:</p>
<pre><code class="elixir">plug CORSPlug, [origin: &quot;example.com&quot;]</code></pre>
<p>Please find the list of current defaults in <a href="lib/cors_plug.ex#L5:L13">cors_plug.ex</a>.</p>
<h2 id="License"> License</h2><p>Copyright 2014 Michael Schaefermeyer</p>
<p>Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at</p>
<pre><code class="elixir">http://www.apache.org/licenses/LICENSE-2.0</code></pre>
<p>Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</p>

<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.11.3),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
<button class="night-mode-toggle" />
</footer>
</div>
</section>
</div>
<script src="dist/app-6d2e071366.js"></script>
</body>
</html>

7 changes: 5 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ defmodule CorsPlug.Mixfile do
elixir: ">= 1.0.0",
deps: deps,
package: package,
description: description
]
description: description,
docs: [
extras: ~W(README.md CHANGELOG.md)
]
]
end

# Configuration for the OTP application
Expand Down

0 comments on commit 23b783f

Please sign in to comment.