Katana - MVC/HMVC framework for any Node.js samurai.

1,098 views
Skip to first unread message

Shogun

unread,
May 8, 2012, 6:17:24 PM5/8/12
to nod...@googlegroups.com
Hi all!

I know there already a lot of mini and almost full future frameworks for Node.js but anyway i build my own.

There are few reasons why i'm doing this:
1. Learn more about node and its modules
2. Build a intuitive, easy to use and fast development framework
3. I dont like the way of routing is done in Express and taken by other frameworks. I want classical routing on regexp like in CodeIgniter framework from php or other, which help much more easier maintainance.
URI will be parsed by default as:

and a few more, doesn't matter...

So i develop a MVC/HMVC framework called Katana (https://github.com/Shogun147/Katana)

Install from npm: 
npm install -g katana

Generate application with katana executable:
katana create [path]

and ready to start: node app

Features:
* Environment based configuration
* Classical routing and re-routing for mvc modules
* Basic mvc + mvc modules which could be used as widgets maybe or just as work modules
* Cookies, Sessions, form data and upload parser(formidable)
* ...

Basic home controller looks like: 

[code=javascript]
var App = require('katana');

require('joose');

Class('Home_Controller', {
  isa: App.Controller,

  methods: {
    index: function(Response, Request) {
      // Response.render('index', { title: 'Hello Katana!' });
 
      Response.send('Hello Katana!');
    }
  }
});

module.exports = new Home_Controller;
[/code]

Also modules can be used as middleware or something like this:
Auth module maybe
[code=javascript]
var App = require('katana');
var User = App.Model('auth:user');

App.on('request', function(Request, Response, callback){
  Request.user = new User(Request.session);

  callback();
});
[/code]

and then in controlller you can get user:
[code=javascript]
Class('Home_Controller', {
  isa: App.Controller,

  methods: {
    index: function(Response, Request) {
      var User = Request.user;

      // use User model ...
    }
  }
});
[/code]

Anyone interested or who like the framework idea can contribute by sending new ideas, issues or pull requests. Any contribution is welcomed.

Have any questions? Please contact me or write in this topic and i'll answer.

Hope with your help first release will come soon as possible.

Thanks.

sorry for my english...

EllisGL

unread,
May 29, 2012, 4:48:15 PM5/29/12
to nod...@googlegroups.com
Just wanted to say, so far it looks good. Was wondering if you are going to do a tutorial. Something like a guest book with a DB backend, sessions / cookies, and something showing integration with socket.io.

Bernardo Rosmaninho

unread,
May 29, 2012, 5:09:07 PM5/29/12
to nod...@googlegroups.com
Well done! I ll try it! Congratz man!

Bernardo Rosmaninho




2012/5/29 EllisGL <xel...@gmail.com>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Shogun

unread,
May 30, 2012, 10:29:03 AM5/30/12
to nod...@googlegroups.com
вторник, 29 мая 2012 г., 23:48:15 UTC+3 пользователь EllisGL написал:
Just wanted to say, so far it looks good. Was wondering if you are going to do a tutorial. Something like a guest book with a DB backend, sessions / cookies, and something showing integration with socket.io.

Hi EllisGL, for sure i will write some tutorial, soon.

Thanks Bernardo. ;)

Bernardo Rosmaninho

unread,
May 30, 2012, 11:45:03 PM5/30/12
to nod...@googlegroups.com
Shogun, I'm getting this error:

bernardo@eniac ~/Projetos $ katana create app
Create application at: /home/bernardo/Projetos/app/ ? [Yes|No]: y
Done!
bernardo@eniac ~/Projetos $ cd app/
bernardo@eniac ~/Projetos/app $ node app

module.js:337
    throw new Error("Cannot find module '" + request + "'");
          ^
Error: Cannot find module 'katana'
    at Function._resolveFilename (module.js:337:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (/home/bernardo/Projetos/app/app.js:1:73)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)

Att,
Bernardo Rosmaninho




2012/5/30 Shogun <shog...@gmail.com>

--

Lorenzo Giuliani

unread,
May 31, 2012, 5:39:28 AM5/31/12
to nod...@googlegroups.com
The workflow should be:

```
$ katana create app
...
$ cd app
$ npm install
...
$ node app
```

unless you have the NODE_PATH (deprecated?) env pointing to your global "node_modules"
ex:
```
$ echo $NODE_PATH
/usr/local/lib/node_modules
$
```

Att,
Bernardo Rosmaninho




2012/5/30 Shogun <shog...@gmail.com>

Shogun

unread,
May 31, 2012, 6:25:18 AM5/31/12
to nod...@googlegroups.com
Lorenzo,
yes, it's right, i know and this is in my todo for this days.

Bernardo,
for the moment you could install locally also (npm install katana)

четверг, 31 мая 2012 г., 12:39:28 UTC+3 пользователь Lorenzo Giuliani написал:

Shogun

unread,
May 31, 2012, 7:29:14 AM5/31/12
to nod...@googlegroups.com
I updated executable, so now the workflow is:
...
 $ npm install -g katana

 $ katana create app
 $ cd app
 $ npm install

 $ node app
...

Please note that for the moment Katana is a little unstable and npm version is actually forced development version, until we get a more stable one (0.1.0). 

Shogun

unread,
May 31, 2012, 1:55:03 PM5/31/12
to nod...@googlegroups.com
Maybe someone has a good idea for a example application? 
I think to write an Todo manager like other frameworks have, but don't know if this is a right choose...

Bernardo Rosmaninho

unread,
May 31, 2012, 3:26:49 PM5/31/12
to nod...@googlegroups.com
Ok, i ll try it today! 
Bernardo Rosmaninho




2012/5/31 Shogun <shog...@gmail.com>

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to

EllisGL

unread,
Jun 2, 2012, 12:03:45 AM6/2/12
to nod...@googlegroups.com
I think the "Todo" app is today's version of the guest book tutorials. It shows off post requests, DB connectivity and web sockets.

I did notice that you have a Authentication and Authorization script, which would be nice to see too. 

EllisGL

unread,
Jun 8, 2012, 7:44:24 PM6/8/12
to nod...@googlegroups.com
Shogun,

Wondering how you use the session plugin? I'm hoping to use sessions with the MVC part and socket.io part.

On Tuesday, May 8, 2012 5:17:24 PM UTC-5, Shogun wrote:

Shogun

unread,
Jun 9, 2012, 9:25:29 PM6/9/12
to nod...@googlegroups.com
Hi EllisGL, sorry for the late response.

So i updated readme with this https://github.com/Shogun147/Katana#sessions and pushed few updates. Hopes this will be enough for now, but ask if something is not clear.

Also this days i'll end write a todo application which use auth module and mongoose.

Also i created Katana group https://groups.google.com/forum/?fromgroups#!forum/katana-js for particular problems and things like this.


суббота, 9 июня 2012 г., 2:44:24 UTC+3 пользователь EllisGL написал:

Kenneth "Ellis" McCall

unread,
Jun 9, 2012, 11:31:37 PM6/9/12
to nod...@googlegroups.com
Sweet! Thanks!

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en



--
Kenneth Ellis McCall

Shogun

unread,
Jun 15, 2012, 3:40:53 PM6/15/12
to nod...@googlegroups.com
As i promised here is a simple ToDo app running on Katana.
I didn't have too much time for it, but more features will come later.


How to get and how it looks like: https://vimeo.com/44121494
Reply all
Reply to author
Forward
0 new messages