user9807244
user9807244

Reputation:

Express/Pug. Server side rendering vs client side rendering

I am kind of confused when it comes down to what is client-side and what is server-side. I am currently building a website, using Pug for my HTML pages, no HTML pages with <script src="myscripts.js"></script> etc.

So am i rendering my pages Server side, since i don't have any files being loaded in the clients browser? Or is it client side, since the Client can click around and see things being updated?

I think what confuses me, is that normally when i build in Java i have HTML pages with scripts in them. But since i am building both front and backend in Javascript, it's kind of hard for me to understand who is rendering what.

I apologize if it's a huge noob question, but i would really like to understand it once and for all.

Thanks in advance.

Upvotes: 1

Views: 2901

Answers (2)

ramazan793
ramazan793

Reputation: 689

In your case, it's server-side rendering, because server compiles Pug to HTML then sends it to the client(already done HTML), unlike client-side frameworks(like angular, react, vue) where HTML page renders on client-side(browser).

Upvotes: 4

Luca Kiebel
Luca Kiebel

Reputation: 10096

The scripts inside of <script> Tags are loaded by the client, and the JavaScript is also run by them.

What the server does is compile Pug to HTML so the client can display it.

If the client clicks something and it changes that is likely some front-end framework that is actively changing the DOM

Upvotes: 0

Related Questions