Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
C# JavaScript Other
Clone or download
Latest commit bfd8432 May 9, 2018
Permalink
Failed to load latest commit information.
Images Big icon added Apr 5, 2017
LoadTests Load tests updated Aug 22, 2014
src XML references added May 9, 2018
.gitignore Min CSS generated, temp CSS fix Feb 11, 2016
LICENSE Initial commit Oct 22, 2013
README.md Title added May 9, 2018
appveyor.yml Formatting fix May 9, 2018

README.md

Simplify.Web

Simplify

Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.

This project is a continuator of AcspNet web-framework

Package status

Latest version Nuget version
Dependencies NuGet Status

Issues status

Ready issues
Stories in Ready

Build status

Branch .NET (4.5.2)
master AppVeyor Build status
develop AppVeyor Build status

Main features

  • Based on MVC and MVVM patterns
  • Comes as OWIN middleware
  • Uses switchable IOC container for itself and controllers, views constructor injection (Simplify.DI)
  • Mono-friendly
  • Support async controllers
  • Uses fast templates engine (Simplify.Templates)
  • Supports controllers which can be run on any page
  • Localization-friendly (supports templates, string table and data files localization by default)
  • Mocking-friendly

Getting started

The examples below shows simple backend HTML generation, but you can easily use any front end technologies with Simplify.Web like AngularJS etc.

Getting started page

Some examples

Simple static page controller

// 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 new StaticTpl("Static/About", StringTable.PageTitleAbout);
    }
}

Any page controller 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;
    }
}

Templates example

Master.tpl
<!DOCTYPE html>
<html>
<head>
    <title>{Title}</title>
</head>
<body>
    {MainContent}
</body>
</html>
About.tpl
<div class="container">
    Welcome to about page!
</div>

Detailed documentation