• 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

    1. How can I get the value of each :tag and in which file do I have declare my functions?

    2. How can I pass data from libary.js into my controllers.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. πŸ™‚

  • NodeBB

    req.params.tag will give you the parameter.

  • NodeBB

    req.params.tag will give you the parameter.

Suggested Topics

| |