문제

I want to add Pagedown (Stack Exchange's markdown, installed from npm) to Sailsjs. I have it properly 'required' in my application.js file, however I am stumped as to how to use it anywhere outside of said file.

My goal is to use Pagedown either in a controller's action function, or for a model's beforeUpdate(). Any leads?

도움이 되었습니까?

해결책

if you add a service (./api/services/) with the name pagedown.js containing:

module.exports = require("pagedown");

you have the pagedown object globally available.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top