docs/basic_example.html
<!DOCTYPE html>
<html>
<head>
<title>Arc Example</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul class="sections">
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="arc-example">Arc Example</h1>
<p>This is a basic app created using Arc.</p>
<ul>
<li>This example has one microservice that simply returns “hello world”</li>
<li>This example uses the <a href="https://www.npmjs.com/package/arc.extension-api">Arc Extension - API</a></li>
<li>Run using: <code>node basic_example.js</code></li>
</ul>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>Load <a href="https://www.npmjs.com/package/arcms">Arc</a> resources</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">const</span> arc = <span class="hljs-built_in">require</span>(<span class="hljs-string">`arcms`</span>);</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<p>Load the <a href="(https://www.npmjs.com/package/arc.extension-api">API extension</a> resources</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">const</span> apiExtension = <span class="hljs-built_in">require</span>(<span class="hljs-string">`arc.extension-api`</span>);</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<p>Define the <a href="https://github.com/altereagle/arc/wiki/Microservice-Manifests">manifest</a> to use</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">const</span> manifest = {
<span class="hljs-string">'Example'</span>: {
<span class="hljs-attr">resource</span> : <span class="hljs-string">`example`</span>,
<span class="hljs-attr">description</span>: <span class="hljs-string">`This is a very simple microservice example.`</span>
}
};</pre></div></div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
<p>Add the API extension and set the port to 8080</p>
</div>
<div class="content"><div class='highlight'><pre>arc.addExtension(apiExtension, {
<span class="hljs-attr">port</span>: <span class="hljs-number">8080</span>
});</pre></div></div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">¶</a>
</div>
<p>Configure and start the App</p>
</div>
<div class="content"><div class='highlight'><pre>arc(manifest)
.then(<span class="hljs-function"><span class="hljs-params">()</span> =></span> {
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Arc Example Online`</span>.bold.cyan);
});</pre></div></div>
</li>
</ul>
</div>
</body>
</html>