easyexpress

0.5.8 • Public • Published

Easy Express (EE Framework)

A Node.js framework based on express.js to create an app in easy way. It is based on modular web application approach. Just like in some known PHP frameworks like ZendFramework, EE lets you create separate directories for each of your app's modules like "site", "admin" or "api".

npm version

Table of contents

[TOC]

Installation

  • Create an empty Node.js project.
  • Install the latest version of Easy Express from npm:
  npm install easyexpress
  • Initialise the project. This will set up new project structure as it is needed by the framework.
$ node_modules/.bin/easyexpress
  • Start the app with running simple node command:
$ node bin/www

That's all, click here to see the result

Project structure

Here is what file structure will be generated for a new EE project

Screen Shot 2015-03-26 at 12.39.59 PM.png

Auto generators

EE Framework provides useful commands to automatically generate site modules and controllers. Just run the commands from project directory.

Create Module

$ node_modules/.bin/easyexpress module=<moduleName>

For example, running this script with moduleName equal to admin (node_modules/.bin/easyexpress module=admin) will create folder admin with nested controllers, views and mids folders.

Create Controller in a Module

$ node_modules/.bin/easyexpress module=<moduleName> controller=<controllerName>

For example, running this script with moduleName equal to admin and controller=user (node_modules/.bin/easyexpress module=admin controller=user) will create folder admin with nested controllers, views and mids folders if it does not exist and add a controller called UserController with sampe index action.

DB integration

Mongodb and mongoose

The EE Framework is ready to work with mongoDb and mongoose. You can tell the project initiation script to automatically add a mongoose dependency with sample config files and models by passing additional argument.

$ node_modules/.bin/easyexpress mongoose=true

Or you can install the module manually by running

$ npm install mongoose

and uncommenting db configurations in application/config/config.ini file:

;=========MONGO==========
[mongo]
hosts = localhost:27017
dbname = dbname

[development.mongo]
hosts = localhost:27017
dbname = dbname

The mongoose can be used in controller actions or any other functions by simply requiring it with var mongoose = require('mongoose'). It is also attached to controllers and can be accessible by this.mongoose parameter.

GridFs

If you are using gridfs in your project you can install the gridfs-stream package either automatically or manually with the following commands:

  • Automatic
$ node_modules/.bin/easyexpress gridfs=true
  • Manual
$ npm install gridfs-stream

Models

The EE Framework works perfectly with usual mongoose models. It automatically loads any model found under models directory.

If you chose to auto-install mongoose during project init, you will find two sample mongoose models there (TestModel.js and FsFilesModel.js).

Afterwards if you want to create a model manually you should add a file in models directory with name ending with 'Model.js' (i.e. UserModel.js). Only these files will be automatically loaded by the framework.

redis

Install redis-client-wrapper package or redis

$ npm install redis-client-wrapper

or
$ npm install redis (for more info)

Tests

npm test

Contributing

Release History

  • 0.3.2 now mongoose and redisClient available from controller class. in action function call this.mongoose and this.redisClient bugs fixes
  • 0.1.0 Initial release

Package Sidebar

Install

npm i easyexpress

Weekly Downloads

2

Version

0.5.8

License

ISC

Last publish

Collaborators

  • harutsos
  • sosw