Gum-Joe / jakhu

Manage all your web-apps with ease :closed_lock_with_key: :computer: :fireworks:
Other
1 stars 2 forks source link

Add api #39

Open Gum-Joe opened 8 years ago

Gum-Joe commented 8 years ago

We need an api to use for modules. I think it should work like this:

  1. Jakhu looks at a list of modules and requires each entry file for each module package.json)
  2. INIT function is called on each module, using the params (app, jakhu, done). app is the express app object with some functions removed, jakhu is the jakhu api with tools for notifications, db, adding middleware, adding routes and pages and done(err, {function: function}) is a function to tell jakhu of errors and supply the RUN function.
  3. INIT function returns done to run on jakhu to add routes .etc
  4. done returns a err or function return value
  5. RUN function (and other functions such as module.hello()) in done is executed
  6. Module is running (i.e. watching for requests or using loaded express middleware)

When adding express middleware, the object in done includes an express function ({express: expressfunction}).

Gum-Joe commented 8 years ago

Sub issues:

Gum-Joe commented 8 years ago

We've started making the logging api (#42)

Gum-Joe commented 8 years ago

Logging api on hold

Gum-Joe commented 8 years ago

Will work on modules