Cyrus
CyrusJS is an implementation or wrapper for the ExpressJS framework. Cyrus was created with the intention to assist in the rapid deployment of standardized web applications and provide a small level of convention over configuration such as auto-loading controllers. Cyrus is configuration file driven and is easy to setup environments for multiple developers and servers. The Cyrus Generator The goal was to assist developers and teams in creating consistent code bases for multiple modules or applications accross time, thereby creating a more devloper friendly environment and making future development, patching and training easier and more cost effective.
Disclaimer
Cyrus is being used in multiple applications in production, but I would recommend making sure you tie your project to a specific release. If you are interested in making any sugesttions please fork and submit a pull request and I will merge as quickly as possible.
Getting Started
Cyrus can very easily be used on it's own, however using the yeoman generator will fully and correctly stub out a working example site. The generated code is very lightweight and will give you a running site in about 1 minute.
Visit The Cyrus Generator For Full Documentation
Config File Properties
Property | Opt? | Default | Description |
---|---|---|---|
ssl | yes | False | Run the app in https mode? |
app_mode | None | -2 (test), -1 (dev), 0 (stage), 1 (production) | |
server_port | None | Port to run webserver on | |
public_folder | yes | public | Absolute path to public folder |
controllers_folder | yes | app/controller | Absolute path to controllers folder (recursive) |
model_root | yes | app/model | Absolute path to models folder |
views_folder | yes | app/view | Absolute path to views folder |
view_engine | yes | jade | View engine, Express property |
enable_js_middleware | yes | False | Enable the JS middleware inline pre-compiler |
js_folder | yes | app/resources/js | Absolute path to raw javascript folder |
enable_less_middleware | yes | False | Enable the JS middleware inline pre-compiler |
less_folder | yes | app/resources/less | Absolute path to raw LESS folder |
cookie_secret | Express Middleware Cookie Secret | ||
session_secret | Express Middleware Session Secret | ||
mongoose | yes | {} | Mongoose connection properties. See example |
redis | yes | {} | Redis connection properties. See example |
mysql | yes | {} | MySql connection properties. See example |
mailserver | yes | {} | Mail Server properties. See example |
Config File Example
var path = require('path')
exports.load = function(appRoot) {
var config = {};
config["ssl"] = false;
config["app_mode"] = -1; // -2=test, -1=dev, 0=stage, 1=production
config["server_port"] = 8000;
config["public_folder"] = path.resolve("./client/public");
config["controllers_folder"] = path.resolve("./server/controller");
config["model_root"] = path.resolve("./lib/model");
config["view_engine"] = "jade";
config["views_folder"] = path.resolve("./client/view");
config["enable_js_middleware"] = true;
config["js_folder"] = path.resolve("./client/resources/js");
config["enable_less_middleware"] = true;
config["less_folder"] = path.resolve("./client/resources/styles");
config["cookie_secret"] = "Xv2Irkb7SfsPhz-AQ-33xGdIqFslrf5uE9N";
config["session_secret"] = "1440qWCyzQr_82w275wPX1LPodLSZK0EhyR";
config["mongoose"] = {
"connection": "mongodb://localhost/myapp_io"
, "store_sessions": false
};
config["mysql"] = {
"host": '127.0.0.1',
"user": 'jonny5',
"password": '3@8721^$324#',
"database": 'myapp_io',
"connectionLimit": 10 // ConnectionLimit will force the use of the MySQL pool
};
config["redis"] = {
"host": "127.0.0.1"
, "port": 6379
};
config["mailserver"] = {
"host": "mailtrap.io"
, "port": 465
, "secureConnection": false
, "auth": {
"user": "192328c6d3465317b"
, "pass": "1e0e737a891852"
}
};
// You can also write functions inside your configuration
config["getModel"] = function(model) {
return require(path.join(path.resolve("./lib/model"), model + ".js"));
}
return config;
}