Small extendable REST framework for express and mongoose.
$ npm install rest-io --save
- Custom Resource declarations
| var Animal = clazz(function Animal(){ | |
| this.private = { | |
| name: 'animal' | |
| }; | |
| this.public = { | |
| sayHello: function sayHello(){ | |
| return 'Hi, my name is ' + this.private.name + '!'; | |
| } | |
| }; | |
| }); |
| function Animal(){} | |
| Animal.prototype = { | |
| name: 'animal', | |
| sayHello: function sayHello(){ | |
| return 'Hi, my name is ' + this.name + '!'; | |
| } | |
| }; | |
| function Dog(){} |
| var Animal = clazz(function Animal(){ | |
| this.private = { | |
| name: 'animal' | |
| }; | |
| this.public = { | |
| sayHello: function sayHello(){ | |
| return 'Hi, my name is ' + this.private.name + '!'; | |
| } | |
| }; | |
| }); |
| var Animal = clazz(function Animal(){ | |
| this.protected = { | |
| name: 'animal' | |
| }; | |
| this.public = { | |
| sayHello: function sayHello(){ | |
| return 'Hi, my name is ' + this.protected.name + '!'; | |
| } | |
| }; | |
| }); |
| var Animal = clazz(function Animal(){ | |
| this.private = { | |
| name: 'animal' | |
| }; | |
| this.public = { | |
| sayHello: function sayHello(){ | |
| return 'Hi, my name is ' + this.private.name + '!'; | |
| } | |
| }; | |
| 'use strict'; | |
| var express = require('express'); | |
| var mongoskin = require('mongoskin'); | |
| var allowCrossDomain = function(req, res, next) { | |
| res.header('Access-Control-Allow-Origin', '*'); | |
| res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); | |
| res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); |
| function Router(){ | |
| this.addRoute = function addRoute(route){ | |
| route.url = route.url || 'defaultUrl'; | |
| route.name = route.name || 'defaultName'; | |
| // Do your stuff | |
| } | |
| } |
| --- | |
| Banana | |
| type: object | |
| properties: | |
| id: | |
| type: string | |
| description: Mongoose ID | |
| description: | |
| type: string | |
| description: Some text to describe this specific banana |
| #!/bin/bash | |
| function print_help_dup() { | |
| echo " usage:" | |
| echo " dup [-i|--image] (options)" | |
| echo | |
| echo " -i|--images required The name of the docker image you to load into your container" | |
| echo " dup -i node" | |
| echo " -cmd|--command optional Provide a different command to run" | |
| echo " default: /bin/bash" |