Skip to content

Commit

Permalink
update docs and api dist
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeh committed Apr 25, 2019
1 parent 51c2731 commit d24b8b7
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions api/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const lambda = (req, res) => {
return () => {}
}


try {
const { from, subject, text } = JSON.parse(req.body)

Expand All @@ -58,8 +57,7 @@ ${text}`,

smtpTransport.close()
})
}
catch(e) {
} catch (e) {
res.writeHead(400, { 'Content-Type': 'text/plain' })
res.end('Invalid Data')
return
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8"/><link rel="icon" href="/contact/favicon.ico"/><link rel="stylesheet" href="/contact/magic.css"/></head><body><div id="magic"><div class="wrapper"><div class="page"><div>404 - not found</div></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script type="text/javascript" src="/contact/magic.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/contact/favicon.ico"/><link rel="stylesheet" href="/contact/magic.css"/></head><body><div id="magic"><div class="wrapper"><div class="page"><div>404 - not found</div></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script type="text/javascript" src="/contact/magic.js"></script></body></html>
Binary file modified docs/404.html.gz
Binary file not shown.
1 change: 0 additions & 1 deletion docs/404/index.html

This file was deleted.

Binary file removed docs/404/index.html.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8"/><link rel="icon" href="/contact/favicon.ico"/><link rel="stylesheet" href="/contact/magic.css"/></head><body><div id="magic"><div class="wrapper"><div class="page"><div><h1>@magic-modules/contact</h1><p>this is the <a href="https://github.com/magic-modules" target="_blank" rel="noopener">@magic-modules</a> Contact component. It sends email using any smtp server that allows username/password authentication.</p><ul class="GitBadges"><li><a href="https://www.npmjs.com/package/@magic-modules/contact" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/v/@magic-modules/contact.svg" role="presentation" alt=""/></a></li><li><a href="https://travis-ci.com/magic-modules/contact" target="_blank" rel="noopener"><img src="https://travis-ci.com/magic-modules/contact.svg?branch=master" role="presentation" alt=""/></a></li><li><a href="https://ci.appveyor.com/project/jaeh/contact/branch/master" target="_blank" rel="noopener"><img src="https://img.shields.io/appveyor/ci/jaeh/contact/master.svg" role="presentation" alt=""/></a></li><li><a href="https://coveralls.io/github/magic-modules/contact" target="_blank" rel="noopener"><img src="https://coveralls.io/repos/github/magic-modules/contact/badge.svg" role="presentation" alt=""/></a></li><li><a href="https://greenkeeper.io" target="_blank" rel="noopener"><img src="https://badges.greenkeeper.io/magic-modules/contact.svg" role="presentation" alt=""/></a></li></ul><h2>installation</h2><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line">npm<span class="keyword"> </span>install<span class="keyword"> </span>magic-modules/contact</code></pre></div><h2>config</h2><div>configuration includes multiple files.</div><div>refer to the <a href="https://zeit.co/docs/v2/deployments/configuration/" target="_blank" rel="noopener">now.sh docs</a> for more information</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><code class="line comment">// /now.json</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;env&#39;</span>: [</code><code class="line"> <span class="string">&#39;SMTP_USER&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_PASS&#39;</span></code><code class="line"> ]</code><code class="line">}</code><code class="line"></code><code class="line"><code class="line comment">// /now-required.json</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;SMTP_USER&#39;</span>: <span class="string">&#39;@smtp-user&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_PASS&#39;</span>: <span class="string">&#39;@smtp-pass&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_HOST&#39;</span>: <span class="string">&#39;smtp.mailserver.com&#39;</span></code><code class="line">}</code><code class="line"></code><code class="line"><code class="line comment">// /now-secrets.json</code></code><code class="line"><code class="line comment">// !add file to .gitignore</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;@smtp-user&#39;</span>: <span class="string">&#39;your@mailserver.com&#39;</span>,</code><code class="line"> <span class="string">&#39;@smtp-pass&#39;</span>: <span class="string">&#39;password&#39;</span></code><code class="line">}</code></pre></div><h2>usage</h2><div>first register this component</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><code class="line comment">// process.cwd()/assets/index.js</code></code><code class="line"></code><code class="line"><span class="keyword">const</span><span class="keyword"> </span>Contact = <span class="keyword">require</span>(<span class="string">&#39;@magic-modules/contact&#39;</span>)</code><code class="line"></code><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> Contact,</code><code class="line"><code class="line comment"> //... other exports</code></code><code class="line">}</code></pre></div><div>then, in a page:</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line">Contact(),</code></pre></div><h2>example</h2><div>this is how it looks (this form has no server attached):</div><form id="contact-form" action="/api/contact/" method="POST"><fieldset><div><label for="from">your email</label><input type="email" name="from" value=""/></div><div><label for="subject">subject</label><input type="text" name="subject" value=""/></div><div><label for="text">text</label><textarea rows="10" name="text" value=""></textarea></div><div><input type="submit" value="send email"/></div></fieldset></form></div></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script type="text/javascript" src="/contact/magic.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/contact/favicon.ico"/><link rel="stylesheet" href="/contact/magic.css"/></head><body><div id="magic"><div class="wrapper"><div class="page"><div><h1>@magic-modules/contact</h1><p>this is the <a href="https://github.com/magic-modules" target="_blank" rel="noopener">@magic-modules</a> Contact component. It sends email using any smtp server that allows username/password authentication.</p><ul class="GitBadges"><li><a href="https://www.npmjs.com/package/@magic-modules/contact" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/v/@magic-modules/contact.svg" role="presentation" alt=""/></a></li><li><a href="https://travis-ci.com/magic-modules/contact" target="_blank" rel="noopener"><img src="https://travis-ci.com/magic-modules/contact.svg?branch=master" role="presentation" alt=""/></a></li><li><a href="https://ci.appveyor.com/project/jaeh/contact/branch/master" target="_blank" rel="noopener"><img src="https://img.shields.io/appveyor/ci/jaeh/contact/master.svg" role="presentation" alt=""/></a></li><li><a href="https://coveralls.io/github/magic-modules/contact" target="_blank" rel="noopener"><img src="https://coveralls.io/repos/github/magic-modules/contact/badge.svg" role="presentation" alt=""/></a></li><li><a href="https://greenkeeper.io" target="_blank" rel="noopener"><img src="https://badges.greenkeeper.io/magic-modules/contact.svg" role="presentation" alt=""/></a></li></ul><h2>installation</h2><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line">npm<span class="keyword"> </span>install<span class="keyword"> </span>magic-modules/contact</code></pre></div><h2>config</h2><div>configuration includes multiple files.</div><div>refer to the <a href="https://zeit.co/docs/v2/deployments/configuration/" target="_blank" rel="noopener">now.sh docs</a> for more information</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><code class="line comment">// /now.json</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;env&#39;</span>: [</code><code class="line"> <span class="string">&#39;SMTP_USER&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_PASS&#39;</span></code><code class="line"> ]</code><code class="line">}</code><code class="line"></code><code class="line"><code class="line comment">// /now-required.json</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;SMTP_USER&#39;</span>: <span class="string">&#39;@smtp-user&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_PASS&#39;</span>: <span class="string">&#39;@smtp-pass&#39;</span>,</code><code class="line"> <span class="string">&#39;SMTP_HOST&#39;</span>: <span class="string">&#39;smtp.mailserver.com&#39;</span></code><code class="line">}</code><code class="line"></code><code class="line"><code class="line comment">// /now-secrets.json</code></code><code class="line"><code class="line comment">// !add file to .gitignore</code></code><code class="line">{</code><code class="line"> <span class="string">&#39;@smtp-user&#39;</span>: <span class="string">&#39;your@mailserver.com&#39;</span>,</code><code class="line"> <span class="string">&#39;@smtp-pass&#39;</span>: <span class="string">&#39;password&#39;</span></code><code class="line">}</code></pre></div><h2>usage</h2><div>first register this component</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line"><code class="line comment">// process.cwd()/assets/index.js</code></code><code class="line"></code><code class="line"><span class="keyword">const</span><span class="keyword"> </span>Contact = <span class="keyword">require</span>(<span class="string">&#39;@magic-modules/contact&#39;</span>)</code><code class="line"></code><code class="line"><span class="keyword">module</span>.<span class="keyword">exports</span> = {</code><code class="line"> Contact,</code><code class="line"><code class="line comment"> //... other exports</code></code><code class="line">}</code></pre></div><div>then, in a page:</div><div class="Pre light"><div class="menu"><button>dark</button><button>copy</button></div><pre><code class="line">Contact(),</code></pre></div><h2>example</h2><div>this is how it looks (this form has no server attached):</div><form id="contact-form" action="/api/contact/" method="POST"><fieldset><div><label for="from">your email</label><input type="email" name="from" value=""/></div><div><label for="subject">subject</label><input type="text" name="subject" value=""/></div><div><label for="text">text</label><textarea rows="10" name="text" value=""></textarea></div><div><input type="submit" value="send email"/></div></fieldset></form></div></div><footer class="main"><div class="wrapper">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></footer></div></div><script type="text/javascript" src="/contact/magic.js"></script></body></html>
Binary file modified docs/index.html.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/magic.css

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

Binary file modified docs/magic.css.gz
Binary file not shown.
Loading

0 comments on commit d24b8b7

Please sign in to comment.