UNPKG

sheercms

Version:

Sheer Cliff CMS is a simple and powerful content management system (CMS) for Node JS.

121 lines (85 loc) 4.06 kB
# sheercms Sheer Cliff CMS is a powerful, yet easy to use, content management system for Node JS. ## Website For more information about the Sheer Cliff CMS and to read the documentation, visit [www.sheercms.com](http://www.sheercms.com) ## What's New? This version now includes a setup wizard that is run after you install the CMS and browse to the website for the first time. The wizard will create an admin account for you and install a starter website that demonstrates content types, templates, item groups, pages, and media items. It's an EASY way to a get started on your first Sheer Cliff CMS website! ## Installation To install the Sheer Cliff CMS for Node JS, run this NPM command: npm install sheercms You will also need the following modules installed to run the website on express (and to use the sample app.js below): npm install express npm install express-session npm install cookie-parser npm install body-parser npm install method-override npm install errorhandler To support images in the CMS, you'll need to install Graphics Magick ([www.graphicsmagick.org](http://www.graphicsmagick.org)) on the server. ## Running the Sheer Cliff CMS Here is a sample app.js for your first CMS website: ```js var express = require('express'); var http = require('http'); var path = require('path'); var session = require('express-session'); var server = express(); // all environments server.set('port', process.env.PORT || 3000); server.set('views', path.join(__dirname, 'views')); server.set('view engine', 'ejs'); //static files var age = 86400000 * 7; //one day * 7 server.use(express.static(path.join(__dirname, 'public'), { maxAge: age })); server.use(require('body-parser')()); server.use(require('method-override')()); server.use(require('cookie-parser')('mycookiesecret')); server.use(session({ secret: 'mysessionsecret', key: 'sid'})); // development only if ('development' == server.get('env')) { server.use(require('errorhandler')()); } //setup public routes for your application (not managed by the CMS) //you don't need to create any custom routes, this is just in case you want routes that //are outside of the CMS. //server.get('/custom-route', routes.customRoute); //setup the CMS var cms = require('sheercms'); //set the application root cms.setRoot(__dirname); //register CMS plugins cms.registerPlugin('media', require('./node_modules/sheercms/plugins/media/media.plugin')); cms.registerPlugin('ckeditor', require('./node_modules/sheercms/plugins/ckeditor/ckeditor.plugin')); //the cache plugin is optional. You'll need redis installed on your server. var cache = require('./node_modules/sheercms/plugins/redis/redis.plugin'); cache.setOptions('YourWebsiteName'); //port, host, options); cms.registerPlugin('cache', cache); //set the CMS options here instead of in the actual config file so we can safely upgrade without losing settings var options = { database_connection: "mongodb://localhost/YourDBName", database_name: "YourDBName", check_install: true, setup_admin_user: false, //automatically create the default admin account. Not recommended - use the install wizard instead. logging: { level: "info", console: true } }; //initialize the CMS cms.init(server, options, function(err) { //tell the CMS not to process requests starting this this path //cms.addIgnorePath('/my-custom-pages/'); if (err) { console.error('Error initializing the CMS: ' + err); } else { //start accepted requests http.createServer(server).listen(server.get('port'), function(){ console.log('Express server listening on port ' + server.get('port')); }); } }); ``` After installing the NPM packages and updating your app.js file to look like the sample above. Just browse to your site's home page to start the Sheer Cliff Setup Wizard. For example, browse to http://localhost:3000/ To log into the CMS console, append /cms to the end of your website's URL. For example, browse to http://localhost:3000/cms