Maruoboe Eibun for Japanese Documentation - noppoMan/maruoboe_eibun_for_japanese GitHub Wiki
Installation
First, please git clolne https://github.com/noppoMan/maruoboe_eibun_for_japanese.git to your server.
Maruoboe Eibun for Japanese requires mongodb.
Please install it, if you didn't install on your server.
http://docs.mongodb.org/manual/installation/
Download source from git repository
git clone https://github.com/noppoMan/maruoboe_eibun_for_japanese.git
cd ./maruoboe_eibun_for_japanese
Configuration
If you want to switch setting by environment, you need to create bootstrap.js and environment config files.
mv config/sample.bootstrap.js config/bootstrap.js
mv config/environment/sample.development.js config/environment/development.js
Edit your config/environment/development.js
//If you want to use WebSocket on reverseproxy, you need to write this configuration.
configure.add('websocketsProxyPort', 8888);
/**
* database server configuration example
* /
databse.add('mongo_master',{
adapter : 'mongo',
host : 'localhost',
dbName : 'maruoboe_eibun_dev',
port : null,
});
Edit your config/environment/development.js
exports.init = function(req, res){
var configure = require("../core/configures/configure");
configure.add("BASE_URL", req.protocol + "://" + req.headers.host + "/");
configure.add("NODE_WORK_URL", req.protocol + "://" + req.host + ":" +configure.get('port') + "/");
//get configuration by host
if(req.host == "production.com"){
configure.add("ENV", "production");
require('./environment/production');
}
else if(req.host == "development.com"){
configure.add("ENV", "development");
require('./environment/development');
}
//other setting examples
//enable xhr-polling on cross domain
res.setHeader("Access-Control-Allow-Origin", "*");
}
Create database on mongodb
npm install opts
node mongoCreate.js host port
Run app
node app.js
Please access http://yourdomain.com:3000
API Reference
View Helpers
You can use view helper.
View helper makes your development easy, when you do html coding and want to integrate the client side coding rule.
sample.ejs
//css
<%- helper.loader('css', 'common.css'}, {rel : "stylesheet", type : "text/css"}) %>
//javascript
<%- helper.loader('js', 'sample.js'}, {defer : "defer"}) %>
<%- helper.loader('js', 'sample.js'}, {defer : "defer"}) %>
//images
<%- helper.loader('img', 'icon.png'}, {width : "50", height : "50"}) %>
<%- helper.loader('img', 'icon.png'}, {id : "hogehoge"}) %>
//link
<%- helper.link("article/123", "go") %>
<%- helper.link("article/save", "save", {id : 'save'}) %>