AromaSharp 1.0.0

dotnet add package AromaSharp --version 1.0.0
                    
NuGet\Install-Package AromaSharp -Version 1.0.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="AromaSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AromaSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AromaSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AromaSharp --version 1.0.0
                    
#r "nuget: AromaSharp, 1.0.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.
#:package AromaSharp@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AromaSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AromaSharp&version=1.0.0
                    
Install as a Cake Tool

AromaSharp — Lightweight C# Web Framework

AromaSharp is a small, expressive web framework for .NET inspired by the simplicity of microframeworks.
It provides an Express and Aroma.js like API for routing, middleware, static files, simple templating, sessions, and body parsing — all in a single minimal library you can reference in your projects.


Features

  • get, post, put, delete, all route helpers
  • Middleware pipeline with use(...)
  • parseBody() middleware to populate req.Body (JSON & form-urlencoded)
  • Rate limiter and logger middlewares
  • Module mounting from DLLs (mount(...))


Quick start

Example Program.cs using AromaSharp API:

using System;
using AromaSharp;

class Program
{
    static void Main(string[] args)
    {
        var app = new Aroma();

        // Enable body parsing middleware so req.body is available in POST handlers
        app.parseBody();

        // Log all requests
        app.logger();

        // Simple GET
        app.get("/", async (req, res, next) =>
        {
            await res.send("Hello from AromaSharp!");
        });

        // POST that expects JSON or form data
        app.post("/echo", async (req, res, next) =>
        {
            // req.body will be populated by parseBody() middleware
            await res.json(new { received = req.body, query = req.query });
        });

        // Start listening (blocks the thread)
        app.listen(5000, () => Console.WriteLine("AromaSharp running at http://localhost:5000"));
    }
}

API Reference (selected)

Aroma (main app)

  • new Aroma() — create app instance
  • use(middleware) — add middleware: async (req, res, next) => { ...; await next(); }
  • use(path, router) — mount sub-router at path
  • get/post/put/delete/all(path, handlers...) — register routes
  • parseBody() — enable automatic parsing of JSON or application/x-www-form-urlencoded
  • serveStatic(directory) — serve files from directory
  • mount(directory) — load .dll modules implementing IAromaModule
  • logger() — attach request logger middleware
  • rateLimiter(options) — attach rate limiter middleware
  • listen(port, started) — start server (blocking)
  • stop() — stop server

Request req

  • req.Path, req.Url, req.HttpMethod
  • req.Query — query string dictionary
  • req.Params — route params from :param style routes
  • req.Body — populated by parseBody() (Dictionary<string, object> for JSON/form)
  • req.Cookies — cookie dictionary

Response res

  • res.status(code) — set status code (returns res)
  • res.setHeader(name, value) — set header
  • res.send(string) / res.send(byte[], contentType) — write body
  • res.json(object) — serialize to JSON and send
  • res.redirect(url) / res.redirect(status, url)
  • res.cookie(name, value, options) — set cookie

Body parsing

Call app.parseBody() once during setup and all route handlers will have req.body populated for requests with:

  • Content-Type: application/json (deserializes to Dictionary<string, object>)
  • Content-Type: application/x-www-form-urlencoded (parsed into Dictionary<string, object>)

Example client request JSON:

{
  "name": "Aavesh",
  "email": "aavesh@example.com"
}

In your handler:

var name = req.body["name"] : null;

Contributing

Contributions welcome — open an issue or PR for enhancements (routing features, multipart parser, template improvements, etc.).


License

MIT © Aavesh Jilani

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 210 8/13/2025