ProxyR - SQL Server to REST API Middleware
ProxyR is a powerful .NET middleware that automatically exposes SQL Server table-valued functions, inline table-valued functions, and views as REST API endpoints. It simplifies the process of creating APIs from your database functions and views with minimal configuration.
Why ProxyR?
- Zero-Code API Creation: Turn your SQL Server functions into REST endpoints without writing any additional code
- Flexible Configuration: Customize your API endpoints with prefixes, suffixes, and routing options
- Built-in Documentation: Automatic OpenAPI/Swagger documentation generation
- Security First: Built-in parameter exclusion and modification capabilities
- Database-Agnostic: Works with any SQL Server database
- Convention-Based: Simple and consistent naming conventions for automatic API mapping
Quick Start
1. Install the Package
dotnet add package ProxyR.Middleware
2. Configure Your Services
Add ProxyR to your service collection in Startup.cs
:
public void ConfigureServices(IServiceCollection services)
{
services.AddProxyR(options => options
.UseConnectionString("your_connection_string")
.UseDefaultSchema("ProxyR")
.UseFunctionNamePrefix("Api_")
);
}
3. Create Your Database Objects
Follow our naming conventions to automatically expose your database objects as API endpoints:
-- Create a view for basic data
CREATE VIEW ProxyR.Api_Users_View AS
SELECT Id, Username, Email
FROM dbo.User;
-- Create a function for searchable grid
CREATE FUNCTION ProxyR.Api_Users_Grid
(
@SearchTerm NVARCHAR(50) = NULL
)
RETURNS TABLE
AS
RETURN
(
SELECT Id, Username, Email
FROM dbo.User
WHERE (@SearchTerm IS NULL OR Username LIKE '%' + @SearchTerm + '%')
);
These will automatically be exposed as:
GET /users
- Returns all usersGET /users/grid?searchTerm=john
- Returns filtered users
4. Enable the Middleware
Add ProxyR to your application pipeline:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseProxyR();
}
Documentation
Check out our comprehensive documentation:
- Getting Started Guide - Quick setup and basic usage
- Database Setup - How to structure your database
- Naming Conventions - Recommended naming patterns
- Configuration Guide - Detailed configuration options
- Query Parameters - Working with parameters and filters
- Security Guide - Security best practices and considerations
- Examples - Common use cases and examples
- Troubleshooting - Common issues and solutions
- API Reference - Complete API documentation
Community
License
ProxyR is licensed under the MIT License. See the LICENSE file for details.