Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[api] stubbing out service starting

  • Loading branch information...
commit eb11c5b2cebd33700551130b60b647509f3233be 1 parent f297ef4
@Marak Marak authored
View
33 app/monitor/index.js
@@ -1,15 +1,34 @@
// simple monitoring application
+var sys = require('sys'),
+ eyes = require('eyes'),
+ hookio = require('../../lib/hookio');
-var sys = require('sys'), eyes = require('eyes');
-var hookio = require('../../lib/hookio');
+// Remark: we are going to hardcode a hook here to demonstrate when a hook might look like
+function Hook( name ) {
+
+ this.id = new Date().getTime(); // replace this with unique ID from DB
+
+ this.start = function( options ){
+
+
+
+ }
+
+ this.callback = function( result ){
+
+ };
+
+
+
+}
-// we are going to hardcode a hook here to demonstrate when a hook might look like
-eyes.inspect(hookio);
+var monitor = new Hook('monitor');
-exports = function() {
+monitor.callback = function(){
- return hook;
-};
+};
+
+eyes.inspect(monitor);
View
30 lib/hookio/core.js
@@ -1,8 +1,36 @@
/* hook.io core */
-var http = require('http');
+var sys = require('sys'),
+ eyes = require('eyes'),
+ http = require('http'),
+ hookio = require('../hookio');
exports.start = function(){
+
+ /**
+ startup basic http server that will eventually manage hook.io
+ this server will continously run, meaning hook.io will always stay on
+
+ **/
+ sys.puts('> hook.io server started on port 8080');
+ http.createServer(function(req, res){
+
+ sys.puts('request in');
+ res.writeHead(200);
+ res.write('hook server up');
+ res.end();
+
+ }).listen(8080);
+
+
+ /**
+
+ startup availble hook.io services
+ **/
+ for(var service in hookio.services){
+ hookio.services[service].start();
+ }
+ eyes.inspect(hookio.services);
};
View
1  lib/hookio/services.js
@@ -10,7 +10,6 @@ require.paths.unshift(__dirname);
var services = exports;
-services.version = '0.1.0';
services.scheduler = require('services/scheduler');
services.proxy = require('services/proxy');
services.shell = require('services/shell');
View
1  lib/hookio/services/proxy.js
@@ -0,0 +1 @@
+exports.start = function(){};
View
3  lib/hookio/services/scheduler/core.js
@@ -4,6 +4,7 @@ exports.start = function() {
/* when starting the scheduler service, get all timer hooks and start them */
+ /*
hookIO.db.getHooks({
protocol: 'timer'
}, function(hooks) {
@@ -21,6 +22,8 @@ exports.start = function() {
timers[duration] = setTimeout(callback, duration, duration);
}
});
+ */
+
};
exports.createTask = function() {
View
1  lib/hookio/services/shell.js
@@ -0,0 +1 @@
+exports.start = function(){};
View
2  server.js
@@ -1,2 +1,2 @@
var server = require('./lib/hookio');
-server.init();
+server.start();
Please sign in to comment.
Something went wrong with that request. Please try again.