Search code examples
progressive-web-appsrazor-pages

Razor Pages as PWA


I've been diving into Razor Pages, but also have a need to create PWA apps. Everything I see about PWAs are related to Blazor. Can a web application created with Razor Pages be converted to a PWA?


Solution

  • As I know, C# Razor Framework is a Server Rendering framework(SSR), so in any request from browser to server, html is returned. This feature is the opposite of PWA (Client side rendering (CSR)), in which just the first request from browser to server returns html. Consecutive request are performed to the related rest-api or microservice which returns only json

    So, in Razor, if you manage to avoid html creation at server layer (which is the core of server rendering frameworks) and perform the forms creation and other UI tasks with pure javascript (like react, angular, vue, etc) instead Razor features, you could convert it to a pwa, adding the classic manifest, service-worker and other required files for a basic pwa application.

    If you choose that, you could ask this to your self: Why I'm using a backend (c#) framework just to generate a minimal index.html instead of using the powerful Razor features?

    Maybe it is time to move from classic web server frameworks which use server languages (c#, java, python, ruby, etc) to latest javascript frameworks like : react, angular, vue, aurelia, linkstart, etc

    Check this resources: