blob: 169626d23231950d3a13eee3737ebc5442da4a1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
var OKView = require('okview');
/**
* OKRestEndpoint!
* Takes a resources and creates a CRUD endpoint.
*/
function OKRestEndpoint(resource, options) {
if (!(this instanceof OKRestEndpoint)) return new OKRestEndpoint(resource, options);
options = options || {};
this._resource = resource;
}
OKRestEndpoint.prototype.middleware = function() {
var self = this;
return function handleREST(req, res, next) {
res.send(self._resource.name);
};
}
module.exports = OKRestEndpoint;
|