csharpfritz / InstantAPIs

A library that generates Minimal API endpoints for an Entity Framework context.
MIT License
448 stars 57 forks source link

Custom API Endpoints #64

Closed ChessGeekBoy closed 2 years ago

ChessGeekBoy commented 2 years ago

As of now, (correct me if I'm wrong) InstantAPIs supports creating all API endpoints (HTTP GET, GET by ID, POST, PATCH, PUT, and DELETE) or just one. It might be nice if it allowed the user to customize which ones they create. For example, a user might only want HTTP GET and DELETE endpoints.

csharpfritz commented 2 years ago

This is already possible with the IncludeTable configuration instruction. The configuration suggested is possible with the following:

app.MapInstantAPIs<MyContext>(config =>
{
    config.IncludeTable(db => db.Contacts, ApiMethodsToGenerate.Get | ApiMethodsToGenerate.Delete, "addressBook");
});