Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module API for both external usage and default resources #19

Open
xaviervia opened this issue Aug 30, 2013 · 0 comments
Open

Module API for both external usage and default resources #19

xaviervia opened this issue Aug 30, 2013 · 0 comments
Milestone

Comments

@xaviervia
Copy link
Member

Something along the lines of:

var jstp = require("jstp");

var Module = {
  routes: [
    {
      { method: "GET", resource: ["article", ":name"] }, 
      Module.getArticle, Module
    }
  ],
  getArticle: function (message) {
    console.log(message.params.name);
  }
}

jstp.use(Module);

Also, default modules should be includable in many ways:

default

var jstp = require("jstp");
jstp.default();

extra paranoid

in this example jstp is not configured to be gateway because the module is not loaded

var jstp = require("jstp");
jstp.use(jstp.module.guard);

// not pictured: jstp.use(jstp.module.gateway);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant