I
I
Ivan2015-08-20 08:57:06
Node.js
Ivan, 2015-08-20 08:57:06

Is the application designed correctly on node.js + jade + react?

Greetings.
I plan to develop an application consisting of:
- templates that will be written in jade,
- components that will interact with different APIs via AJAX - on react (they will be embedded into the page after rendering the main part of the page, so that part of the content is given to the user immediately)
- node.js + express server script that runs it all.
Question:
1. You need to render jade templates "on the fly" at the request of the client, i.e.:

app..set('viewEngine', 'jade');	
    app.get('/',function (req, res) {
    res.render('pages/landing', {locals:{'text':'demo'}} );

  });

Or is it better to collect them with gulp in html, and give ready-made html with express?
2. Does it affect performance when there is a lot of traffic?
3. If I have an authorization that is stored in the session, I can use it when rendering the template, i.e. so that for example in the header I was shown "you entered as Vasya"? (similar to php, only on server js)
ps This is my first application on node.js. Thanks to everyone who will respond.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Abdullaev, 2015-08-20
@usyninis

Why is jade here if React can render on the server as well ( React.renderToString and React.renderToStaticMarkup )?

G
GiperScriper, 2015-08-20
@GiperScriper

consider giving the static to nginx, and let node give json only, authorization will be needed - screw it on the token.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question