Wisp Documentation

Getting Started

This guide walks you through creating your first Wisp application from scratch.
We’ll build a minimal web app with a controller and a template-based view.


  1. Create a new Console project
    Wisp is designed to work with a plain console project:

    dotnet new console -n MyWispApp
    cd MyWispApp
    
  2. Add the Wisp Framework package
    Add the Wisp NuGet package to your project

    dotnet add package Wisp.Framework
    
  3. Configure and start Wisp
    In Program.cs, configure Wisp, add routes, and start the server:

    using Wisp.Framework;
    
    var appBuilder = new WispHostBuilder().Build();
    
    appBuilder
        .UseControllers(); // Enable controller discovery
        .ConfigureRoutes(r => 
        {
            // Add a simple Hello World route
             r.Get("/hello", async ctx => WispHttpResponse.Ok("Hello, World!");
        });
    
    var app = appBuilder.Build();
    
    // Run the app
    await app.RunAsync();
    
  4. Create a controller
    Any class annotated with the [Controller] attribute will be discovered automatically.
    Add a new class HomeController.cs:

    [Controller]
    public class HomeController : ControllerBase
    {
        [Route("/")]
        public async Task<IView> Index()
        {
            return View("demo");
        }
    }
    
  5. And a template view
    Create a Templates directory in your project root and add demo.liquid:

    <h1>Hello, World!</h1>
    
  6. Run your app
    Start your project with dotnet run

  7. Open your app in a browser
    Go to http://localhost:6969 and have fun