CodeNewbie Community

loading...

How does "server side rendering" work?

mikeymike profile image Michael ・1 min read

Hi all! Glad to be a CodeNewbie!

I've been diving into the backend portion of my online coding course and am having trouble understanding server side rendering.

Can anybody provide some insight into how this works?

Thanks peeps!

Discussion (1)

pic
Editor guide
Collapse
jasonbraganza profile image
Jason Braganza

Hello Michael,

in the context of web stuff

Client side rendering is when stuff is processed on your browser or a program on your machine.

Server side rendering is when stuff is processed on a server.

a small example would be,
I could have form that asks you for you phone number.
I would want to check if you entered it in correctly, if it has the right number of digits, if the country code is valid etc.

So I could either
make the browser check the number (via some code in javascript in your browser. this would be client side rendering)
or check it on the server once you submit it (via some program in python or node or whatever runs on the server. this would be server side rendering)

so processing is always a question of resources and time and capabilities.
it also decides on the languages you’d need to use.

small stuff like i described above is easily done by javascript on your local computer.
but if you want to query a large multigigabyte database, that is something probably better handled by a more powerful remote server

so you’d send your query or your data or whatever to the server, which picks it up, processes it and returns the results back to you

With the Django course I am doing, I am querying some real estate site for house listings.
The query is sent to the server, handed to Django, which queries the database, formats the results and then sends it back to the browser which displays it to me