FastProjects.Endpoints 1.0.8

dotnet add package FastProjects.Endpoints --version 1.0.8                
NuGet\Install-Package FastProjects.Endpoints -Version 1.0.8                
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="FastProjects.Endpoints" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FastProjects.Endpoints --version 1.0.8                
#r "nuget: FastProjects.Endpoints, 1.0.8"                
#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 FastProjects.Endpoints as a Cake Addin
#addin nuget:?package=FastProjects.Endpoints&version=1.0.8

// Install FastProjects.Endpoints as a Cake Tool
#tool nuget:?package=FastProjects.Endpoints&version=1.0.8                

To configure the repository template:

  1. Update workflows. If you use CodeQL, rename the codeql.yml.example to codeql.yml.
  2. Create a solution file and add projects to .src/ or .tests/ folders.
  3. Fill the information in .nuspec file about nuget package.
  4. Update README.md file (also, remove this section).

πŸš€ FastProjects.Endpoints

Build Status NuGet NuGet Downloads License Last Commit GitHub Stars GitHub Forks

🚨 ALERT: Project Under Development This project is not yet production-ready and is still under active development. Currently, it's being used primarily for personal development needs. However, contributions are more than welcome! If you'd like to collaborate, feel free to submit issues or pull requests. Your input can help shape the future of FastProjects!


πŸ“š Overview

Collection of endpoint base classes that wraps FastEndpoints classes and integrated with MediatR and Result patterns.

Complete documentation of the FastEndpoints can be found here.


πŸ›  Roadmap

  • βœ… FastEndpoint - Base class for endpoints that uses MediatR and Result patterns with response body
  • βœ… FastEndpointWithoutResponse - Base class for endpoints that uses MediatR and Result patterns without response body

πŸš€ Installation

You can download the NuGet package using the following command to install:

dotnet add package FastProjects.Endpoints

Usage

Example of dummy create project use-case implementation:

// Application layer below implemented via MediatR
public sealed record CreateProjectCommand(string Name) : ICommand;
    
public sealed class CreateProjectCommandHandler : SharedKernel.ICommandHandler<CreateProjectCommand>
{
    public async Task<Result> Handle(CreateProjectCommand request, CancellationToken cancellationToken)
    {
        await Task.Delay(1, cancellationToken);
        return Result.Success();
    }
}

// Presentation layer below implemented via FastEndpoints

public sealed class CreateProjectRequest
{
    public const string Route = "/projects";
    
    public static string BuildRoute() => Route;
    
    public string Name { get; set; }
}

public sealed class CreateProjectValidator : Validator<CreateProjectRequest>
{
    public CreateProjectValidator()
    {
        RuleFor(x => x.Name).NotEmpty();
    }
}

public sealed class CreateProjectEndpoint(IMediator mediator)
    : FastEndpointWithoutResponse<CreateProjectRequest,
        CreateProjectCommand,
        Result>(mediator)
{
    public override void Configure()
    {
        Post(CreateProjectRequest.Route);
        Version(0);
        AllowAnonymous();
        
        Summary(s =>
        {
            s.ExampleRequest = new CreateProjectRequest { Name = $"Test Project" };
        });
    }
    
    protected override CreateProjectCommand CreateMediatorCommand(CreateProjectRequest request) =>
        new(request.Name);
}

More example can be found in sample TestApp project.


🀝 Contributing

This project is still under development, but contributions are welcome! Whether you’re opening issues, submitting pull requests, or suggesting new features, we appreciate your involvement. For more details, please check the contribution guide. Let’s build something amazing together! πŸŽ‰


πŸ“„ License

FastProjects is licensed under the MIT License. See the LICENSE file for full details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.8 418 9/18/2024
1.0.7 115 9/18/2024