Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor framework - backend or frontend?

What kind of framework is Razor? Is it backend or frontend? What is the difference between the two types of frameworks? I'm trying to learn a little bit more about backend and frontend frameworks and since I usually work with Visual Studio Asp.net MVC was wondering about it.

like image 957
Diogo Martinho Avatar asked Jul 20 '16 18:07

Diogo Martinho


People also ask

Is Razor server-side or client side?

Razor components can run server-side in ASP.NET Core (Blazor Server) versus client-side in the browser on a WebAssembly-based . NET runtime (Blazor WebAssembly, Blazor WASM). You can also host Razor components in native mobile and desktop apps that render to an embedded Web View control (Blazor Hybrid).

Is Razor better than MVC?

From the docs, "Razor Pages can make coding page-focused scenarios easier and more productive than using controllers and views." If your ASP.NET MVC app makes heavy use of views, you may want to consider migrating from actions and views to Razor Pages.

Is .NET core front end or backend?

ASP.NET Core is an open-source and free framework that follows in the footsteps of ASP.NET, a widely-used backend created in partnership with the . NET Foundation. ASP.NET Core is a modular framework that can run across the entirety of the . NET Framework across on Windows and .


2 Answers

It is not a framework . I think you're misinterpreting certain concepts. Razor is a server side view engine, and it uses C # or VB.NET to generate dynamic content.

Razor Syntax Quick Reference

like image 167
Eulogy Avatar answered Nov 25 '22 08:11

Eulogy


This question is a couple of years old, but I'm going to add my two cents.

People struggle to give an answer to this question because the terms 'front-end' and 'back-end' aren't formally defined anywhere. Because of that, any answer is purely subjective.

That being said, it is my opinion that the relationship between front-end/back-end and client-side/server-side isn't necessarily one-to-one

I think it helps to think of it like this: client-side and server-side are run-times, while front-end and back-end are a separation of concerns.

'Client-side' always refers to code executing on the client's machine and 'server-side' always refers to code executing on the server. A 'front-end' developer deals with displaying data to the user and getting data from the user, while a back-end developer deals with storing, manipulating, and retrieving that data.

Consider a front-end developer who is tasked with building a UI. Much of the code they write will be the typical HTML / CSS / JS. However, they will also have to deal with the data that is passed to the front-end from the backend. This is where Razor comes into play. The front-end developer will write the Razor code (which executes on the server-side) to display the data.

That is, the front-end developer will write server-side code to help generate the UI, in addition to writing the client-side code that really defines the UI.

Now, I can't imagine a scenario where a back-end developer will write client-side code.

So, to answer your question, Razor is a front-end technology that executes on the server-side runtime. It's only purpose is to generate the UI, which is the concern of the front-end.

like image 43
koolahman Avatar answered Nov 25 '22 09:11

koolahman