npm install cmeasy







> Content API Library
``js`
require('cmeasy')({
models: [
{
name: 'Home Page',
singleton: true,
definition: {
title: {
type: 'String',
label: 'Home Page Title',
default: 'Default Home Page Title'
}
}
}
]
});
`js`
require('http').get({
host: '127.0.0.1',
path: '/api/v1/content/homePage'
});
__Or__
`js
require('cmeasy')({ / ... / })
.then(function(cmeasy){
cmeasy.getModel('homePage').index();
});
`
__Or__
`html`
`bash`
npm install cmeasy --save
See an example running on Heroku https://cmeasy.herokuapp.com/
__Or__
Deploy your own demo to Heroku 
__Or__
See an example React app using the content on jsfiddle.net
___
See server/options.js for the complete demo configuration
`js
var express = require('express');
var app = express();
require('cmeasy')({
// ...
express: app
// ...
});
var server = require('http').createServer(app);
server.listen(9000, '127.0.0.1');
`
`js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/cmeasy');
require('cmeasy')({
// ...
mongoose: mongoose
// ...
});
`$3
`
// null values indicate that the given property is optional
// By default no models are defined. The following is an example
const models = [
{
name: string,
// If true, more than one instance of this model may exist. If false, only one instance
// can be created
singleton: null | boolean,
disableDelete: null | boolean,
disableCreate: null | boolean,
definition: {
title: {
type: 'String',
label: null | string,
displayColumn: null | boolean,
},
category: {
type: 'Select',
label: null | string,
enum: string[]
},
},
initialData: {
clean: boolean, // Clear all existing models at startup
data: [
{
title: 'A title',
category: 'Category'
}
]
}
}
];
// The following shows the default value for options.initalUsers
const initialUsers = {
// If true, cmeasy will remove all users at startup
clean: boolean,
data: [
{
name: 'Test User',
email: 'test@test.com',
password: 'test'
},
{
name: 'Admin',
role: 'admin',
email: 'admin@admin.com',
password: 'admin'
}
]
};
// Every parameter is optional
const options = {
name: null | string,
mongoose: null | mongoose.Connection,
express: null | express.Application,
rootRoute: null | string,
models: models,
initialUsers: null | initalUsers
}
const cmeasy = require('cmeasy')(options);
`
TODO
TODO
See website for complete API (TODO)
- Demo site showing the decouple presentation app using this library - Home Page + Blog.
- Default to using in memory database and remove Mongo requirement. Mongo support via dao plugin.
- Api-check options + Integration tests
- Refactor angular into separate project. Pure ES5/6 data layer library wrapped in angular module.
- Basic User Management / Integrations
- Basic Author/Publisher workflow
- Draft content versions / API
- Self documenting Content API
- More field types + field type plugin api
- Order property for fields presentation order in form
- JSON export / import
- Improve protractor automation coverage
- Performance test mongo
- Performance test API
- Git
- Node.js and npm Node ^4.2.3, npm ^2.14.7
- Bower (npm install --global bower)npm install --global grunt-cli
- Grunt ()mongod
- MongoDB - Keep a running daemon with
1. Run git clone https://github.com/Kauabunga/cmeasy.git to clone the repositorynpm install
2. Run to install server dependencies.bower install
3. Run to install front-end dependencies.mongod
4. Run in a separate shell to keep an instance of the MongoDB Daemon runninggrunt serve
5. Run to start the development server. It should automatically open the client in your browser when ready.
Contributing is awesome!
Please ensure your contributions come with tests.
#### Release
1. Ensure all tests pass
2. Ensure linting passes
3. npm version git push && git push --tags
4. npm publish
5.
Run grunt build to build the project
Running npm test will run the unit tests with karma.
- Server: grunt test:servergrunt test:client
- Client:
- Project Structure
- Integrate nsp` checks with CI
- Migrate to Pug
Features
- Define content models via config or web client
- Content and content model CRUD API
- User management - with + without email service