jumpropecms
v0.0.1
Published
A primarily flat fs CMS designed for developers to use. Don't expect to edit it much on the client.
Downloads
3
Readme
CMS/framework. Think something between WordPress and Node.js on Rails. Allows real developers to develop and allows their stakeholders to manage their content. (Looking at you WordPress "developers")
Opinionated like Rails.
Uses MongoDB to manage backend.
Has an admin page like WordPress.
TODO:
- Admin page
- How to change what can is editable on the backend with admin page?
- One potential solution would be to predefine services that are editable on the admin page. For instance: products and blog
- Connect DB
- Create and use options passed into init()
- Allow editing of options passed into init() and then reboot server
- Add the ability to extend schemas (for the user schema so that admin logs in with the same credentials for admin page and main site)
- To do ^ we will need the ability to write migrate scripts. Better read up on writing a mf-ing programming language. FML
- Figure out the oxford comma.
- Watch the late night comments. For instance ^ What seems cheeky is generally obnoxious, condescending or both.
Options Passed Into Init()
Four categories
- ENV - Replaces environment variables
- DB - Options for Mongoose and the DB
- Build - Options for the gulp build task that will be inline
- Server - Options applicable to the Web/App/API server
Within the context of the three sub-objects that are not ENV the options object will have access to a copy of ENV. We create this copy in the boot function so don't set options.build.env else it will be overwritten.
ENV Options
- NODE_ENV: Pretty self explanatory. Either null or 'production'.
- PORT: Port for server to listen on. If not specified defaults to 3030.
DB Options
Build Options
Server Options
Options Ideas
- Options of each package
- Logging options
DB
You can specify all the models you want. Once you specify a User model you need to be careful because the default user model will no longer be applicable. This can totally destroy your admin page logins if you aren't careful. For convenience I have provided the original User Schema and Model below.
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcyrpt-nodejs');
const UserSchema = mongoose.Schema({
local : {
email : String,
password : String
},
facebook : {
id : String,
token : String,
email : String,
name : String
},
twitter : {
id : String,
token : String,
displayName : String,
username : String
},
google : {
id : String,
token : String,
email : String,
name : String
}
accessLevel : Number
});
//
// Methods
//
// Generating a hash
userSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
// Checking if password is valid
userSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);
};
//
// Create the User model and expose it to the CMS
//
module.exports = mongoose.model('User', userSchema);