-1

I'm going to create a CMS in Node.js and Express i have a folder structure like below:

  • MyCMS
    • plugins
    • themes
    • uploads
    • index.js

i want to load plugins from plugins folder:

  • plugins
    • sample-plugin
    • awesome-plugin

i want to know how to make my CMS pluggable?

what is best way to make an application pluggable?

and then how to load plugins?

(i need a plugin system at all)

EDIT: As i said, i need a plugin system like wordpress. wordpress has hooks (actions and filters), is it best? how to implement it?

Hasan Bayat
  • 926
  • 1
  • 13
  • 24

1 Answers1

1

You don't really need a plugins folder as NPM essentially does this for you. You then maintain a list of npm packages that are officially supported. You could look at Ember-CLI and see what they do with their 'ember install' and specific packages for Ember.

Bradley
  • 2,071
  • 2
  • 21
  • 32
  • This is good idea. i'm thinking about publish plugins in npm and use them in CMS. but i want to know how to do it? – Hasan Bayat Feb 28 '17 at 08:24
  • google "npm publish" for the official npm docs on publishing packages - after that you'll just need to do npm install 'package-name' – Bradley Feb 28 '17 at 21:44
  • Hi. i know how to publish package, but i don't know how to specific packages in node_modules folder. – Hasan Bayat Mar 01 '17 at 04:23