Nodejs, server side web UI framework?

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
I am looking for a server side framework for generating web pages, in NodeJS/Express. On the front-end there is Vue, React and Angular (amongst others), but beyond EJS, which seems limited in comparison, can anyone a solution? Ideally it would be one that has a good community and an existing component library for us to use.
Generally speaking, why not use Vue, React, or Angular? I mean, if it runs on the client side, and you are using NodeJS, then it should run on the server side too. You should be able to get server side rendering working.
 
Not wanting frameworks like Vue is because we dealing with a case where a REST API can’t be exposed. Even SSR needs to use REST API from what I have seen.

BTW The not using REST is based on security reasons, that we have to deal with. For this reason we are needing to provide the data to the page before it is rendered.

How could it possibly matter to security if the data comes in HTML or JSON?
 

ajmas

Ars Praefectus
3,258
Subscriptor++
Not wanting frameworks like Vue is because we dealing with a case where a REST API can’t be exposed. Even SSR needs to use REST API from what I have seen.

BTW The not using REST is based on security reasons, that we have to deal with. For this reason we are needing to provide the data to the page before it is rendered.

How could it possibly matter to security if the data comes in HTML or JSON?

The idea is the latter is easier to parse. Anyhow there is no REST API for us to consume and they’d like to reduce the amount of front-end JS.
 

ajmas

Ars Praefectus
3,258
Subscriptor++
The idea is the latter is easier to parse. Anyhow there is no REST API for us to consume and they’d like to reduce the amount of front-end JS.

So it has nothing to do with security?

Well the initial argument given about exposing a REST API was, but at this point we don't have a REST API and we just need a server side web UI framework.

At this point we are starting to look at Handlebars, since we need to start: https://handlebarsjs.com/
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
The idea is the latter is easier to parse. Anyhow there is no REST API for us to consume and they’d like to reduce the amount of front-end JS.

So it has nothing to do with security?

Well the initial argument given about exposing a REST API was, but at this point we don't have a REST API and we just need a server side web UI framework.

At this point we are starting to look at Handlebars, since we need to start: https://handlebarsjs.com/

Perhaps you should point out that HTTP/HTTPS *is* the prototypical REST API? As in: all HTML websites are in fact REST APIs.
 

ajmas

Ars Praefectus
3,258
Subscriptor++
Perhaps you should point out that HTTP/HTTPS *is* the prototypical REST API? As in: all HTML websites are in fact REST APIs.

Uh. That is just semantics and is really just spending more time not answering the initial question.

Most people will expect a REST API to be accepting some sort of request by underlying JS code and responding with JSON or something else that will need a JS layer to interpret, rather than being handled by the browser straight. Again, I didn't come here for a religious debate on front-end frameworks vs back-end frameworks, which this has become.
 
Again, I didn't come here for a religious debate on front-end frameworks vs back-end frameworks, which this has become.

No, I could care less if you use a front end or back end framework. I just dislike it when people say absolutely unfounded things about security. The number of totaly unqualified people making security decisions in this field is sad and scary.

And since I've never had a need to do server side templating in Node, I have nothing to contribute there. The rare times I wanted a node route to return HTML, I just used template literals (`<b>${htmlSafefoo}</b>`).
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
Perhaps you should point out that HTTP/HTTPS *is* the prototypical REST API? As in: all HTML websites are in fact REST APIs.

Uh. That is just semantics and is really just spending more time not answering the initial question.

Most people will expect a REST API to be accepting some sort of request by underlying JS code and responding with JSON or something else that will need a JS layer to interpret, rather than being handled by the browser straight. Again, I didn't come here for a religious debate on front-end frameworks vs back-end frameworks, which this has become.

And that is something that we do to reduce latency and make the system run better on the client machine. There is no reason you couldn't make the thing return HTML or JSON based on the extension: ask for foo.html, get the rendered view in HTML that works with or without JS; ask for foo.json, get the data in JSON so that the javascript can update the page more quickly. The basic point here is that the reasoning behind "only html" is foolish. It doesn't fundamentally change anything about the service.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
And since I've never had a need to do server side templating in Node, I have nothing to contribute there. The rare times I wanted a node route to return HTML, I just used template literals (`<b>${htmlSafefoo}</b>`).

Or, write it just like you would if it was going to return JSON and then tell it to do server side rendering. Pow, an HTML response for the same code.