How to deal with placeholder in URL?
Solved
Plugin Development
-
Hey! I set up a litte plugin.
plugin.json
"hooks": [ { "hook": "static:app.load", "method": "init" } ]
libary.js -
plugin.init()
router.get('/projects', hostMiddleware.buildHeader, controllers.getCustomParam); router.get('/projects/:tag', hostMiddleware.buildHeader, controllers.getCustomParam);
controllers.js -
Controllers.getCustomParam()
// Template which will be rendered res.render('admin/plugins/mytemplate', { title: "myTitle", sub_title: "thisIsASub" });
Everything works fine so far. But how can I deal with placeholder
/projects/:tag
e.g- /projects/diy
- /projects/mechanics
- /projects/electric
-
How can I get the value of each
:tag
and in which file do I have declare my functions? -
How can I pass data from
libary.js
into mycontrollers.js
?
I want to do some code and functions and pass this data into my template to display it to the user.
It would be nice if anyone could help me.
Copyright © 2024 NodeBB | Contributors