merest
Version:
Express based REST-full API for Mongoose models
945 lines (300 loc) • 12 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class: ModelAPIExpress | Merest</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main"> <h1 class="page-title">Class: ModelAPIExpress</h1>
<section>
<header>
<h2>ModelAPIExpress</h2>
<div class="class-description">ModelAPIExpress - Express application that provides an RESTfull API for different models</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="ModelAPIExpress"><span class="type-signature"></span>new ModelAPIExpress<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="ModelAPIExpress.html">ModelAPIExpress</a>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">API configuration parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">the title of API <SWAGGER></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">the version of API <SWAGGER></td>
</tr>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">the path of api root. The application doesn't mount it self on this path. <SWAGGER></td>
</tr>
<tr>
<td class="name"><code>host</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">the host to reach API. <SWAGGER></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">allows or denies the OPTION end-point on the application level</td>
</tr>
<tr>
<td class="name"><code>transformResponse</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">the function to transform standard response. For details see Transform response</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="model-api-app.js.html">model-api-app.js</a>, <a href="model-api-app.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Created API application
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="ModelAPIExpress.html">ModelAPIExpress</a></span>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="SWAGGER_SUPPORT"><span class="type-signature"></span>SWAGGER_SUPPORT<span class="type-signature"></span></h4>
<div class="description">
SWAGGER_SUPPORT indicates that the module version supports the swagger
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="model-api-app.js.html">model-api-app.js</a>, <a href="model-api-app.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="expose"><span class="type-signature"></span>expose<span class="signature">(path<span class="signature-attributes">opt</span>, middleware<span class="signature-attributes">opt</span>, model, routerOptions<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="ModelAPIExpress.html">ModelAPIExpress</a>}</span></h4>
<div class="description">
ModelAPIExpress.prototype.expose - exposes the mongoose model as RESTFull json service
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">the path to mount exposed model</td>
</tr>
<tr>
<td class="name"><code>middleware</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">one or more middlewares that should be called before each end-point controller</td>
</tr>
<tr>
<td class="name"><code>model</code></td>
<td class="type">
<span class="param-type">Mongoose.Model</span>
</td>
<td class="attributes">
</td>
<td class="description last">Mongoosee model to be exposed</td>
</tr>
<tr>
<td class="name"><code>routerOptions</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">ModelAPIRouter configuration object (see [Router configuration](configuration.html#router))</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="model-api-app.js.html">model-api-app.js</a>, <a href="model-api-app.js.html#line74">line 74</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
itself
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="ModelAPIExpress.html">ModelAPIExpress</a></span>
</dd>
</dl>
<h4 class="name" id="urls"><span class="type-signature"></span>urls<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
ModelAPIExpress.prototype.urls - returns avaliable list of end-points
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="model-api-app.js.html">model-api-app.js</a>, <a href="model-api-app.js.html#line117">line 117</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
list of end-points
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</article>
</section>
</div>
<nav><h2>
<a href="index.html">merest</a>
</h2>
<h3><a href="installation.html">Installation</a></h3>
<ul>
<li><a href="installation.html#prerequisites">Prerequisites</a></li>
<li><a href="installation.html#npm-install">npm installation</a></li>
<li><a href="installation.html#development">Development</a></li>
</ul>
<h3><a href="cook-book.html">Cook-book</a></h3>
<h3><a href="conf-levels.html">API Configuration</a></h3>
<ul>
<li><a href="conf-levels.html">Configuration levels</a></li>
<li><a href="conf-app.html">API Application</a></li>
<li><a href="conf-router.html">Router</a></li>
<li><a href="conf-end-points.html">End-point</a></li>
<li><a href="conf-methods.html">Model methods</a></li>
</ul>
<h3><a href="end-points.html">API Requests and Responses</a></h3>
<ul>
<li><a href="end-points.html">Common reponses</a></li>
<li><a href="end-points.html#ep_options">Options</a></li>
<li><a href="end-points.html#ep_search">Search</a></li>
<li><a href="end-points.html#ep_create">Create</a></li>
<li><a href="end-points.html#ep_details">Details</a></li>
<li><a href="end-points.html#ep_update">Update</a></li>
<li><a href="end-points.html#ep_delete">Delete</a></li>
<li><a href="end-points.html#transform-response">Custom response</a></li>
</ul>
<h3><a href="swagger.html">Swagger support</a></h3>
<ul>
<li><a href="swagger.html#install">Installation</a></li>
<li><a href="swagger.html#api-conf">Configure API</a></li>
<li><a href="swagger.html#document">Creating <code>swagger.json</code></a></li>
<li><a href="swagger.html#api-docs">Exposing the api-docs</a></li>
<li><a href="swagger.html#swagger-ui">Embedded swagger-ui</a></li>
</ul>
<h3>Specifications</h3>
<ul>
<li><a href="ModelAPIExpress.html">ModelAPIExpress</a></li>
<li><a href="merest-swagger.html">Swagger-support methods</a></li>
<li><a href="ModelAPIRouter.html">ModelAPIRouter</a></li>
<li><a href="ModelAPIError.html">ModelAPIError</a></li>
</ul>
</nav>
<br class="clear">
<footer>
Documentation generated with <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>