csharpfritz / InstantAPIs

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

Export the endpoint to a file/class for verification #33

Closed fasteddys closed 2 years ago

fasteddys commented 2 years ago

Hello, is there an option to export the endpoints generated to a log or a class file for us to view or generate a menu context, or generic Ajax caller

csharpfritz commented 2 years ago

Good point... when your app is running and if you added OpenAPI to your application, you COULD grab the swagger.json file to inspect.

I like your suggestion of adding something more native to the tool.

fasteddys commented 2 years ago

Great work BTW @csharpfritz

Is there a way to exportthose endpoints to a Static Class TestMenuHelper, I am trying to test harness to load that class and check the endpoints.

Something like this to expose the EndPoints... (or do you recommend switch over to Swashbuckle/Swagger Typscript for now)

function CallMethod(url, parameters, successCallback) {
                //show loading... image

                $.ajax({
                    type: 'POST',
                    url: url,
                    data: JSON.stringify(parameters),
                    contentType: 'application/json;',
                    dataType: 'json',
                    success: successCallback,
                    error: function(xhr, textStatus, errorThrown) {
                        console.log('error');
                    }
                });
            }

CallMethod(url, pars, onSuccess);

function onSuccess(param) {
    //remove loading... image
    //do something with the response
}
csharpfritz commented 2 years ago

I do still like the logging option of this... creating a separate issue