An extension project of nodejs express framework.
In developing a web application,there will be a mass of views,routes.With default usage of Express, everything is mixed together.This is not conducive to reuse and maintenance of code. This project will build a framework to build a Express with seperated modules(pluings). A module is made up with logic(routes),views and an init.js file.
- ServerSide
- JugglingDB
- Express
- Underscore
- ClientSide
- JQuery
- Underscore
- Do everything Express need.
- Download this project as a nodejs module.And copy all the files to the root dir of Express.
- Make database config,a config of jugglingdb,put everywhere of the project. just like below
var Schema = require('jugglingdb').Schema;
var schema = new Schema('mysql',{
host:'1.1.2.191',
port:3306,
username:'mysql',
password:'mysql',
database:'TEST'
});
module.exports = exports=schema;
- Do some change in app.js
var proto=require('underscore');
var extApp = require('application');
var app =new express();
app.set('db', path.join(__dirname, 'model/db'));
...
app.use(express.cookieParser());
app.use(express.session({ secret: "pluginframework" ,cookie:{maxAge:5*60*60*1000}}));
...
app.initPluginSystem(function(){
});
...
There are several plugins in this project.After server started,u can visit host/site/pluginlistpage to list all the serverside plugins.
A plugin provide simple security service.
- data
- user
- view
- site/loginpage
- site/usermanager
- widget/loginform
- widget/logininfo
- widget/loginout
A plugin provide the web frame,include the main page of website. This plugin just set the defaultLayout of application.
A plugin provide maintance of the server plugins.
- view
- /site/pluginlistpage
- /site/plugindetailpage
- /widget/pluginlist
- /widget/plugindetail