These are chat archives for quorrajs/quorrajs

5th
Jul 2016
maq
@maqboolkhan
Jul 05 2016 10:24
@harishanchu what if im not using controller then how can i name a route??
Harish
@harishanchu
Jul 05 2016 11:30
Sorry, I didn't get you
What did you mean?
maq
@maqboolkhan
Jul 05 2016 15:07

means

Route.get('/', function(req, res){
        console.log(req.csrfToken());
        res.view('index');
});

how to name this?

maq
@maqboolkhan
Jul 05 2016 15:13
have u updated docs ?
this is awesome thanks
Harish
@harishanchu
Jul 05 2016 15:14
Nope. It's the old one itself
maq
@maqboolkhan
Jul 05 2016 15:14
ohhhh
m sorry
one more thing
maq
@maqboolkhan
Jul 05 2016 15:15
yesss this was the point :)
what if there are paramter then how i will use App.url.route
?
Harish
@harishanchu
Jul 05 2016 15:31
you can pass the params array as the second argument
same like laravel
maq
@maqboolkhan
Jul 05 2016 16:35
thanks :)
@harishanchu one more problem m facing
when m doing
console.log(req.csrfToken());
m getting error
session storage not set
Harish
@harishanchu
Jul 05 2016 17:14
csrf token works with the help of session
maq
@maqboolkhan
Jul 05 2016 17:14
yes
then
Harish
@harishanchu
Jul 05 2016 17:15
so, if you want to use csrfToken you need to enable session support as stated here: https://quorrajs.org/docs/v1/middlewares/session.html#configuration
By default session middleware is turned off in app/config/middleware.js. Be sure to turn it on if your application needs session support.
maq
@maqboolkhan
Jul 05 2016 17:15
ohhhhhhhhhhhhhhhh
got it
can i ask why session support is off?
Harish
@harishanchu
Jul 05 2016 17:18
Adding more and more features will slow down the framework, since for each request application has to execute more number of middlewares
maq
@maqboolkhan
Jul 05 2016 17:18
ohhh yup
Harish
@harishanchu
Jul 05 2016 17:19
Hence by default Quorra turns of most of the middlewares which is not required for basic request processing
Users can turn on needed middlewares on demand
maq
@maqboolkhan
Jul 05 2016 17:20
yes this cool :)
Harish
@harishanchu
Jul 05 2016 17:24
Quorra is developed with all these kind of performance considerations in mind. That is why it performs better than other popular NodeJS frameworks :smile:
maq
@maqboolkhan
Jul 05 2016 17:24
@harishanchu when csrf token regenerate automatically?
:+1: no doubt its awesome and it will be on top soon
i read some where but now i forgot
about auto regeneration of token
Harish
@harishanchu
Jul 05 2016 17:27
if you enable session support token will be generated by default
you can access it with one of these methods:
req.session.getToken()
// or
req.csrfToken()
You can also regenerate it with method req.session.regenerateToken()
maq
@maqboolkhan
Jul 05 2016 17:32
so how long this token remain valid?
Harish
@harishanchu
Jul 05 2016 17:33
It will be valid until the session is valid
maq
@maqboolkhan
Jul 05 2016 17:33
ok ok :)