Where to access and store EJS Helpers - SailsJS

前端 未结 3 748
攒了一身酷
攒了一身酷 2021-01-13 08:44

Well,

SailJS\'s default templateing engine is EJS (Embedded Javascript)

But I cannot seem to find the place where we can create ou

3条回答
  •  爱一瞬间的悲伤
    2021-01-13 09:29

    One way to accomplish this is through middleware. Something like:

    module.exports.routes = {
    
      '*': function mixinForm(req, res, next) {
         // <%= form() %>
         res.locals.form = function () {
            return '
    '; }; next(); }, }

    I would also suggest making a feature request for a more integrated approach at: https://trello.com/b/cGzNVE0b/sails-js-feature-requests.

提交回复
热议问题