Giter VIP home page Giter VIP logo

minimal-razor's Introduction

Minimal ASP.NET Core Web App (Razor Pages) template

This template consists of a single content page (Index) with layout and error pages. For information about the remaining pages and code files, see the article Get started with Razor Pages in ASP.NET Core or the README file of MiniRazor.Template (more about that repository below).

Minimal template deployed to Azure

Background

I needed to create a basic Web application - a single page with a few controls and an API call. I enjoyed working with Azure Functions, the related Core Tools package and VS Code, seemlessly switching between Windows and Ubuntu machines, so I decided to use .NET Core for the Web application. Razor Pages appeared on my radar a few times recently.

New project

With .NET Core SDK (v2.1.301) installed, I executed dotnet new razor and was surprised with a new project that was way more complex than I expected. You can check the inital import to see what I mean - I needed a simple scaffolding and got a full-blown application.

I looked for a dotnet new razor option to generate a more basic project, but - finding none - I decided to strip it down to a bare minimum manually. This is why this repository was created.

During this reasearch, I somehow missed MiniRazor.Template that I highly recommend:

The road to the minimal template

I looked for unimportant elements, removed them and the unreferenced pieces left behind:

  • pages:
    • _ValidationScriptsPartial (a reference to the jQuery validation scripts)
    • Contact
    • About
    • Privacy (along with some cookie consent code)
  • libraries:
    • Bootstrap
    • jQuery
  • images
  • most of CSS styling

I kept the directory structure inside wwwroot.

Publishing to Azure

Out of different deployment options available for Web apps, I picked Local Git Repository. After the initial configuration, all I need to do is run git push azure master on my computer and the latest version is deployed. Option GitHub is also trivial to configure and later every time you push new code to the GitHub, it gets automatically deployed to Azure.

For details, refer to the article Publishing a Web Core app to Azure with CLI.

minimal-razor's People

Contributors

chopeen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dimobelov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.