Simplify.Web 5.1.0

dotnet add package Simplify.Web --version 5.1.0                
NuGet\Install-Package Simplify.Web -Version 5.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Simplify.Web" Version="5.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplify.Web --version 5.1.0                
#r "nuget: Simplify.Web, 5.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Simplify.Web as a Cake Addin
#addin nuget:?package=Simplify.Web&version=5.1.0

// Install Simplify.Web as a Cake Tool
#tool nuget:?package=Simplify.Web&version=5.1.0                

Simplify.Web

Simplify

Nuget Version Nuget Download Issues Board Build Package Libraries.io dependency status for latest release CodeFactor Grade Platform PRs Welcome

Simplify.Web is an open-source, lightweight, fast and highly customizable server-side .NET web-framework based on ASP.NET Core for building HTTP based web-applications, RESTful APIs etc.

Framework can be used as:

  • An API backend framework
  • As a mix of API backend + some SPA front end like Angular
  • As an old way backend generated web-site

Can be hosted:

  • The same way as an ApsNetCore MVC application (On IIS, or as a console application)
  • Inside a windows service

Main features

  • Comes as Microsoft.AspNetCore middleware
  • Can be used as an API backend only with front-end frameworks
  • Based on MVC and MVVM patterns
  • Lightweight & Fast
  • Uses switchable IOC container for itself and controllers, views constructor injection (Simplify.DI)
  • Support async controllers
  • Supports controllers which can be run on any request
  • Localization-friendly (supports templates, strings and data files localization by default)
  • Uses fast templates engine (Simplify.Templates)
  • Mocking-friendly
  • Mono-friendly

Quick start

There is a templates package available at nuget.org for Simplify.Web. It contains a couple of templates which can be a good starting point for your application.

Installing a templates package:

dotnet new -i Simplify.Web.Templates
Template Short Name
Angular template sweb.angular
Api template sweb.api
Minimal template sweb.minimal
Windows service hosted api template sweb.api.windowsservice

Use the short name to create a project based on selected template:

dotnet new sweb.angular -n HelloWorldApplication

Then just run project via F5 (it will download all required nuget and npm packages at first build).

Detailed documentation

API outgoing JSON controller v2 example

[Get("api/v1/weatherTypes")]
public class SampleDataController : Controller2
{
    private static readonly string[] Summaries =
    {
        "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
    };

    public ControllerResponse Invoke()
    {
        try
        {
            return Json(items);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);

            return StatusCode(500);
        }
    }
}

API ingoing JSON controller v2 example

[Post("api/v1/sendMessage")]
public class SampleDataController : Controller2<SampleModel>
{
    public ControllerResponse Invoke()
    {
        try
        {
            Trace.WriteLine($"Object with message received: {Model.Message}");

            return NoContent();
        }
        catch (Exception e) when (e is ModelValidationException || e is Newtonsoft.Json.JsonException)
        {
            return StatusCode(400, e.Message);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);

            return StatusCode(500, "Site error!");
        }
    }
}

public class SampleModel
{
    [Required]
    public string Message { get; set; }
}

Some simple HTML generation controllers example

Static page controller v1 example
// Controller will be executed only on HTTP GET request like http://mysite.com/about
[Get("about")]
public class AboutController : Controller
{
    public override ControllerResponse Invoke()
    {
        // About.tpl content will be inserted into {MainContent} in Master.tpl
        return StaticTpl("Static/About", StringTable.PageTitleAbout);
    }
}
Any page controller v1 with high run priority example

Runs on any request and adds login panel to a pages

// Controller will be executed on any request and will be launched before other controllers (because they have Priority = 0 by default)
[Priority(-1)]
public class LoginPanelController : AsyncController
{
    public override async Task<ControllerResponse> Invoke()
    {
        return Context.Context.Authentication.User == null
            // Data from GuestPanel.tpl will be inserted into {LoginPanel} in Master.tpl
            ? new InlineTpl("LoginPanel", await TemplateFactory.LoadAsync("Shared/LoginPanel/GuestPanel"))
            // Data from LoggedUserPanelView will be inserted into {LoginPanel} in Master.tpl
            : new InlineTpl("LoginPanel", await GetView<LoggedUserPanelView>().Get(Context.Context.Authentication.User.Identity.Name));
    }
}
View example
public class LoggedUserPanelView : View
{
    public async Task<ITemplate> Get(string userName)
    {
        // Loading template from LoggedUserPanel.tpl asynchronously
        var tpl = await TemplateFactory.LoadAsync("Shared/LoginPanel/LoggedUserPanel");

        // Setting userName into {UserName} variable in LoggedUserPanel.tpl
        tpl.Add("UserName", userName);

        return tpl;
    }
}

Example applications

Below is the list of sample applications showing different variations of Simplify.Web usage:

Simplify

Contributing

There are many ways in which you can participate in the project. Like most open-source software projects, contributing code is just one of many outlets where you can help improve. Some of the things that you could help out with are:

  • Documentation (both code and features)
  • Bug reports
  • Bug fixes
  • Feature requests
  • Feature implementations
  • Test coverage
  • Code quality
  • Sample applications

Additional extensions to Simplify.Web live in their own repositories on GitHub. For example:

License

Licensed under the GNU LESSER GENERAL PUBLIC LICENSE

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Simplify.Web:

Package Downloads
Simplify.Web.Json

Simplify.Web JSON controller response and model binder

Simplify.Web.MessageBox

Simplify.Web static message box templates and controller response

Simplify.Web.Multipart

Simplify.Web multipart form model binder

Simplify.Web.Postman

Postman collection and environment generation extension for Simplify.Web

Simplify.Web.Swagger

Swagger extensions for Simplify.Web web-framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.1.0 111 7/28/2024
5.0.0 478 6/5/2024
5.0.0-pre02 99 6/5/2024
5.0.0-pre01 352 6/1/2024
4.9.1 148 4/16/2024
4.9.0 233 1/8/2024
4.8.1 631 12/20/2023
4.8.0 113 12/20/2023
4.7.1 639 11/7/2023
4.7.0 576 8/20/2023
4.6.0 3,051 5/17/2022
4.5.1 1,590 4/27/2022
4.5.0 1,490 11/22/2021
4.4.3 434 10/19/2021
4.4.2 560 7/18/2021
4.4.1 408 7/6/2021
4.4.0 1,161 4/25/2021
4.3.0 421 4/22/2021
4.3.0-pre01 272 4/21/2021
4.2.3 1,794 2/27/2021
4.2.2 1,012 12/11/2020
4.2.1 1,142 10/23/2020
4.2.0 516 9/21/2020
4.1.2 718 8/26/2020
4.1.1 1,428 4/29/2020
4.1.0 534 4/1/2020
4.0.2 1,107 1/27/2020
4.0.1 618 1/6/2020
4.0.0 1,278 12/22/2019
4.0.0-pre01 720 12/17/2019
3.0.0 1,527 10/20/2019
2.3.0 1,268 9/28/2019
2.2.0 1,046 9/3/2019
2.1.0 1,080 8/22/2019
2.0.1 591 6/24/2019
2.0.0 1,237 1/1/2019
2.0.0-pre02 561 12/23/2018
2.0.0-pre01 581 12/18/2018
1.7.0 185 4/30/2023
1.6.1 477 4/15/2022
1.6.0 641 9/28/2019
1.5.0 611 9/3/2019
1.4.1 623 6/25/2019
1.4.0 674 5/20/2019
1.3.0 741 12/16/2018
1.2.1 1,119 5/9/2018
1.2.0 1,825 8/23/2017
1.1.0 1,285 2/14/2017
1.0.1 2,375 8/26/2016
1.0.0 1,451 8/26/2016