isomagic-simpleapp
v0.0.6
Published
An IsoMagic extension that creates a simple app
Downloads
2
Maintainers
Readme
IsoMagic-simpleapp
IsoMagic extension that adds simple app capabilities
uses IsoMagic-template to translate a templateid, from res.templateid
with data from res.data
, and apply it to
the app 'body', specified by the config bodySelector
option
This extension requires IsoMagic-template. For details on template file structure, see that repository.
Sample Config file:
{
"extensions" : [
{
"id":"simpleapp",
"require":"isomagic-simpleapp",
"filePath":"node_modules/isomagic-simpleapp/simpleapp.js"
//optional parameter bodySelector described below.
},
{
"id":"template",
"require":"isomagic-template",
"filePath":"node_modules/isomagic-template/template.js",
"templateFiles":["myTemplates.html"]
}
],
"routes" : [
{"middleware" : ["simpleapp#checkpage"]},
{
"method":"get",
"route":"/",
"middleware" : [
{"type":"simpleapp#usetemplate", "templateid":"homeTemplate"}
]
},
{
"method":"get",
"route":"/foo",
"middleware" : [
{"type":"simpleapp#usetemplate", "templateid":"fooTemplate"}
]
},
{"middleware" : ["simpleapp#showpage"]}
]
}
Config
bodySelector
(String) default: "body" a jQuery selector for where the translated template will be applied if"simpleapp#showpage"
is called
Middleware
checkpage
- checks the "body" for the current page against req.originalUrl. If we're already there, halts the middleware chain- [builder]
usetemplate
templateid
: a templateid to be stored inres.templateid
- [builder]
setdata
data
: some data object to be attached tores.data
showpage
- translatesres.templateid
withres.data
using IsoMagic-template, and puts the content into the "body" specified by bodySelector
TLC Formats
none included