meen-core v1.6.0
M.E.E.N
M.E.E.N = MongoDB + ExpressJS + EdgeJS + NodeJS
Methods
composeApp
/**
* Compose an app. You can compose website or api app with built-in modules via `options` or your own fully-customised app by passing modules via `modules`
* @param {String} appName Your app name
* @param {Object} config App configuration, includes built-in modules' and custom configurations
* @param {Array<Function>} modules Module must be function with first param is `app` as Express App Instance and second param is `config`
*/
composeApp(appName, config, modules);
Note: Order of configuration as the following:
1. Default
1. /config/app.js
(will be loaded if available)
1. config
param
composeModel
/**
* Compose a Mongoose model
* @param {String} modelName Name of model
* @param {Object} schema Schema options of mongoose
* @param {Object} options
* @param {Object} options.index Equals with `mongooseSchema.index` method
* @param {Object} options.virtual List of virtual properties with key is name of virtual and value is virtual options. If you pass value as function, it will be getter.
* Example:
* {
* url: {
* get: function () {
* return `/url/${this._id}`;
* }
* },
* type: function () {
* return this.type;
* }
* }
* @param {Array} options.plugins Each plugin will be passed via `mongooseSchema.plugin` method
* @param {Object} options.index Same as `mongooseSchema.index` method
* @param {Object} options.set Same as `mongooseSchema.set` method
* @param {Object} options.static Static properties will be added to model
*/
composeModel(modelName, schema, options, dontEnhance);
Built-in modules
Each module has its own config same as its name. Example: publicFolder
module will use publicFolder
in config
Modules list:
Presets
MEEN provides presets for app types via config.app.preset
. Order of modules will be loaded as specified in below
website
:
api
:
Default configuration
const { resolvePath } = require('meen-utils');
module.exports = {
preset: null,
info: {
title: 'M.E.E.N',
version: '1.0.0',
},
mongoose: {
debug: false,
options: {
useNewUrlParser: true,
useUnifiedTopology: true,
},
itemPerPage: 20,
},
cors: '*',
session: {
secret: 'M.E.E.N',
expires: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
maxAge: 7 * 24 * 60 * 60 * 1000,
},
publicFolder: {
path: resolvePath('public'),
debug: false,
},
view: {
minify: false,
cache: false,
},
handleError: {
enabled: false,
debug: true,
isJson: false,
},
};
License
Please read at here
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago