http://blog.nodejitsu.com/ibm-doesnt-care-about-nodejs-people/framework.png

On Fri, Apr 27, 2012 at 10:39 AM, jason.桂林 <[email protected]> wrote:

> I tested that express is a little slower then non-express code. I planning
> to design a new web framework and I also design a benchmark tool, to make
> sure my framework is fast.
>
> My basic thinking is fast routing, fast session, in memory cache and clean
> code.
>
> The first step is fast routing, I use a mechanism multi routing,
>
> *1st is hash routing, e.g. app.get('/user/login', login),  will routing
> by handlers['/user/login'](req, res);*
> *
> *
> *2nd is multi hash routing, e.g. app.get('/user/:id/edit', editprofile),
> will routing by handlers['user']['*']['edit'](req, res);*
> *
> *
> *3rd is match routing, e.g. app.get(/user\/edit-(\d+)/, editprofile),
> will routing by handlers.forEach(function(rule) { if(rule.test(req.path)
> handlers[rule](req, res) })*
> *
> *
> but before do this, I have to design the routing api. is sinatra like api
> good enough?  when I coding, I still need seprate the routings to different
> files, so we have below code
>
> 1: in app.js:
>
>>   app.get('/user/login', routes.user.login)
>
>
> or 2: in routes/user.js :
>
>   var app = require('../app');
>>   app.get('/user/login, function(req, res, next) { // code here });
>
>
> or 3
> in app.js:
>
>>    require('./routes')(app);
>
>
> in routes/user.js
>
>     module.exports = function(app) {
>>       app.get('/routes/user', function(req, res, next){// code here})
>>     }
>
>
> Did you see the problem?
>
> We can just map  `get.user.login` to GET '/user/login' to save typing and
> ignore circulate dependency.
>
> get/index.js
>> var app = module.export
>> // url: /  url: /index  goes here
>> app.index = function(req, res) {}
>> // url: /user goes here and all request of /user/* not found matchs goes
>> here
>> app.user = require('./user')
>> get/user.js
>> // url: /user/  and url: /user/index goes here
>> user.index = function(req, res){}
>> // url: /user/login goes here
>> user.login = function(req, res) {}
>
>
> but this method has a problem, how define param routing and regex routing?
>
> What do you think about all these things?
>
> --
> Best regards,
>
> Jason Green
> 桂林
>
>
>  --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
-- 
Marak Squires
Co-founder and Chief Evangelist
Nodejitsu, Inc.
[email protected]

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to