A simple mean stack framework
- Go to your project directory using your command line tool then install the following:
npm install
bower install
- Setup
.env
file using your command line tool.
cp .env.example .env
- Run the server, and you're good to go.
node server.js
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 Methodcreate
for GET Methodstore
for POST Methodshow
for GET Methodedit
for GET Methodupdate
for UPDATE Methoddestroy
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.group({ prefix: 'foo', middleware: ['Foo::bar', 'John::doe'] }, function () {
...
// Insert route methods here
...
});
Note: Not yet implemented -- Nested Route Groups
This project is licensed under the MIT License - see the LICENSE file for details