Overview
The API configuration is managed throughappsettings.json and Program.cs in the SolicitudesAPI project.
appsettings.json Structure
Configuration Sections
Logging
Controls application logging behavior:Trace- Most detailed loggingDebug- Debug informationInformation- General informational messagesWarning- Warning messagesError- Error messagesCritical- Critical failuresNone- No logging
AllowedHosts
Specifies which hosts are allowed to access the API:ConnectionStrings
Database connection configuration. See Database Setup for details.JWT Configuration
Authentication settings. See JWT Authentication for details.CORS Configuration
The API includes CORS (Cross-Origin Resource Sharing) configuration to allow requests from the Blazor frontend.Default CORS Policy
Defined inProgram.cs:
Restricting CORS Origins
For production, restrict CORS to specific origins:OpenAPI / Swagger Configuration
The API uses OpenAPI for documentation with Scalar UI.Configuration in Program.cs
Development Environment
OpenAPI and Scalar are enabled only in development:- OpenAPI spec:
https://localhost:5001/openapi/v1.json - Scalar UI:
https://localhost:5001/scalar/v1
QuestPDF License
The application uses QuestPDF for PDF generation with a Community license.Configuration
Set inProgram.cs before building the application:
The Community license is free for open-source projects and non-commercial use. For commercial use, you may need a different license.
HTTPS Configuration
The API enforces HTTPS redirection:Development Certificates
For development, trust the ASP.NET Core development certificate:Environment-Specific Settings
Create environment-specific configuration files:appsettings.Development.json- Development settingsappsettings.Production.json- Production settingsappsettings.Staging.json- Staging settings
Example: appsettings.Production.json
Middleware Pipeline Order
The middleware is configured in the following order inProgram.cs:
- CORS (
app.UseCors) - HTTPS Redirection (
app.UseHttpsRedirection) - Authentication (
app.UseAuthentication) - Controller routing (
app.MapControllers)