kns-cli
Version:
kns cli for hapi.js and sequelize.js
108 lines (96 loc) • 2.23 kB
JavaScript
/**
*
* @File: <%= filename %>
* @Description: TODO < Why we generate this file >
*
*/
var Joi = require("joi");
var Boom = require("boom");
var _ = require("lodash");
var Blueprint = require("kns-plumber").Blueprint;
module.exports = function (_disk, _config) {
blueprintConfig.disk = _disk;
blueprintConfig.config = _config;
/**
* blueprint either
* blueprint: false || blueprint: blueprintConfig
*/
return {
action: <%=controller%>,
blueprint: false
}
};
var blueprintConfig = {
sortable: false,
prettyName: "<%=controllershortname%>",
modelName: "<%=controllershortname%>",
/**
* TODO: dont forget the change baseUrl
* generally pluginName + modelName
* Ex; /backend/customers
*/
baseUrl: "/",
fieldsConfig: {
/**
* model_field_name: {
* "label": "model_pretty_name",
* "ines": "ines",
* "type": "text|textarea|select|relation|image|file",
* "validate": {
* required: true
* }
* },
*/
/**
* image options
*
* image: {
* resize: "!",
* width: 600,
* height: 600,
* storage: "s3"
* }
*/
/**
* relation options
*
* "relation": {
* type: "hasMany",
* model: "table@field"
* }
*/
}
};
//# Rails Convention
var <%=controller%> = {
/**
* Role-based authentication
* example
*/
//"test": {
// auth: {
// mode: "required"
// },
// plugins: {
// "hapi-auth-man": {
// "role": "admin"
// }
// },
// handler: function (request, reply) {
// return reply("test");
// }
//
//}
/**
* Blueprint example
* Dont forget to set fieldsConfig and blueprint field.
*/
//"index": {
// auth: {
// mode: "required"
// },
// handler: function (request, reply) {
// return Blueprint.indexView(request, reply, blueprintConfig);
// }
//}
};