stick
Version:
JSGI based webapp framework
21 lines (17 loc) • 776 B
JavaScript
var stick = require("stick");
var Application = stick.Application, helpers = stick.helpers;
var response = require("stick/lib/utils/response");
var app = exports.app = Application(),
foo = resolve(module, "foo"),
home = resolve(module, "app");
app.configure("route");
// Define an index route that takes optional name and ext arguments.
// Link to the other module's index action with the same name and ext.
app.get("/:name?.:ext?", function(req, name, ext) {
return response.html(
"<html><body><h1>Bar</h1>",
"<p>This is module <b>'bar'</b> called with <b>", name, "</b>, <b>", ext, "</b>. ",
"Go to ", helpers.linkTo(foo, {name: name, ext: ext}),
" or back ", helpers.linkTo(home, {}, "home"), ".</p></body></html>"
);
});