Permalink
Browse files

updated gitignore to only ignore root node_modules folder

  • Loading branch information...
1 parent b6cc4fe commit 9c93bdf0242443663b709a726f9861e6690de227 @ritch ritch committed Jul 31, 2012
Showing with 70 additions and 1 deletion.
  1. +1 −1 .gitignore
  2. +14 −0 test-app/node_modules/hello.js
  3. +30 −0 test-app/node_modules/proxy/index.js
  4. +25 −0 test-app/node_modules/templates/index.js
View
@@ -12,7 +12,7 @@ pids
logs
results
.DS_Store
-node_modules
+/node_modules
npm-debug.log
test/support/keys.json
test/support/proj
@@ -0,0 +1,14 @@
+var Resource = require('deployd/lib/resource')
+ , util = require('util');
+
+function Hello(settings) {
+ Resource.apply(this, arguments);
+}
+util.inherits(Hello, Resource);
+module.exports = Hello;
+
+Hello.prototype.handle = function (ctx, next) {
+ if(ctx.req && ctx.req.method !== 'GET') return next();
+
+ ctx.done(null, {hello: 'world'});
+}
@@ -0,0 +1,30 @@
+/**
+ * example custom resource
+ */
+
+var Resource = require('deployd/lib/resource')
+ , util = require('util')
+ , request = require('request');
+
+function Proxy(settings) {
+ Resource.apply(this, arguments);
+ this.remote = settings.remote;
+}
+util.inherits(Proxy, Resource);
+module.exports = Proxy;
+
+Proxy.prototype.handle = function (ctx, next) {
+ if(ctx.req && ctx.req.method !== 'GET') return next();
+ request.get(this.remote + ctx.url).pipe(ctx.res);
+}
+
+Proxy.label = 'HTTP Proxy';
+Proxy.defaultPath = '/proxy';
+
+Proxy.basicDashboard = {
+ settings: [{
+ name: "remote"
+ , type: "text" //"textarea" or "number" works as well
+ , description: "The remote server to proxy to."
+ }]
+}
@@ -0,0 +1,25 @@
+/**
+ * example custom resource
+ */
+
+var Resource = require('deployd/lib/resource')
+ , util = require('util')
+ , request = require('request')
+ , ejs = require('ejs')
+ , fs = require('fs');
+
+function Templates(settings) {
+ this.path = settings.path;
+ Resource.apply(this, arguments);
+}
+util.inherits(Templates, Resource);
+module.exports = Templates;
+
+Templates.prototype.handle = function (ctx, next) {
+ var out = ejs.render(fs.readFileSync(this.path.replace('/', '') + ctx.url + '.ejs').toString(), {foo: 'bar'});
+
+ ctx.res.end(out);
+}
+
+Templates.label = 'EJS Templates';
+Templates.defaultPath = '/views';

0 comments on commit 9c93bdf

Please sign in to comment.