JSPM

  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q74463F
  • License MIT

Admin-panel for projects based on Express.js and Mongoose.

Package Exports

  • admin-panel

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (admin-panel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NOT FOR PRODUCTION!!!

Requirements:

  • Your app must use own bodyParser, cookieParser, session, postNormalize:

      app.use(bodyParser.json());
      app.use(bodyParser.urlencoded({ extended: true }));
      app.use(cookieParser());
      app.use(session({
        secret: config.get('sessionSecret'),
        resave: true,
        saveUninitialized: false,
        store: sessionStore
      }));
      app.use(postNormalize);
      

    Where postNormalize must parse multipart/form-data request body and populate req.body and req.files properties.

  • Your app must pass session to res.locals.session:

      app.use(function(req, res, next) {
        res.locals.session = req.session;
        next();
      });
  • Your app must use Jade view engine:

      app.set('view engine', 'jade');

Installation:

  • Install package: npm install admin-panel --save

  • Create admin-config.js and describe your models.

  • Setup:

      var express = require('express'),
          models = require('./models'),
          adminConfig = require('./admin-config.js'),
          adminPanel = require('admin-panel')({
            express: express,
            models: models,
            adminConfig: adminConfig,
            storagePath: path.join(__dirname, '../..', 'public/storage')
          });
      
      router.use('/admin', adminPanel);

    Examples of models and admin-config.js in examples/ folder.