/mean-stack-framework

Abel's Mean Framework

Primary LanguageJavaScriptMIT LicenseMIT

Mean Stack Framework

A simple mean stack framework

Getting Started

  1. Go to your project directory using your command line tool then install the following:
npm install
bower install
  1. Setup .env file using your command line tool.
cp .env.example .env
  1. Run the server, and you're good to go.
node server.js

Usage

Routes

GET Method

route.get('<uri>', '<controller>@<method>', [<middlewares>])

POST Method

route.post('<uri>', '<controller>@<method>', [<middlewares>])

UPDATE Method

route.update('<uri>', '<controller>@<method>', [<middlewares>])

DELETE Method

route.delete('<uri>', '<controller>@<method>', [<middlewares>])

RESOURCE Method

route.resource('<uri>', '<controller>@<method>', [<middlewares>], {only|except})

In resource method, it provides get, post, update, and delete method. These are the following methods in controller that uses resource method:

  • index for GET Method
  • create for GET Method
  • store for POST Method
  • show for GET Method
  • edit for GET Method
  • update for UPDATE Method
  • destroy for DELETE Method

You can also limit by using only or except. See example below:

Example #1

module.exports = function (app) {
    route.setModule('User');
    ...
    route.resource('/user', 'UserController', ['User::client'], {
        only: ['index', 'show']
    });
    ...
}

Example #2

module.exports = function (app) {
    route.setModule('Blog');
    ...
    route.resource('/api/blog', 'UserController', ['Auth::isAdmin'], {
        except: ['create', 'edit']
    });
    ...
}

Route Groups

route.group({ prefix: 'foo', middleware: ['Foo::bar', 'John::doe'] }, function () {
   ...
   // Insert route methods here
   ... 
});

Note: Not yet implemented -- Nested Route Groups

Credits

License

This project is licensed under the MIT License - see the LICENSE file for details