Skip to content

Commit a232c03

Browse files
committed
..
1 parent e6ff24a commit a232c03

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This project is a boilerplate for building .NET API applications with various fe
66

77
## Features
88

9+
- [x] Swagger
910
- [x] Authentication using JWT Bearer tokens
1011
- [x] Rate limiting to prevent API abuse
1112
- [x] CORS policies for secure cross-origin requests

src/Program.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
var builder = WebApplication.CreateBuilder(args);
2222

23+
var IsDevelopment = builder.Environment.IsDevelopment();
2324

2425
// ✅ Ensure correct access to configuration
2526
var configuration = builder.Configuration;
@@ -153,8 +154,11 @@
153154
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.Preserve;
154155
});
155156

156-
builder.Services.AddEndpointsApiExplorer();
157-
builder.Services.AddSwaggerGen();
157+
if (IsDevelopment)
158+
{
159+
builder.Services.AddEndpointsApiExplorer();
160+
builder.Services.AddSwaggerGen();
161+
}
158162

159163
// Enable Compression to reduce payload size
160164
builder.Services.AddResponseCompression(options =>
@@ -171,16 +175,17 @@
171175

172176
// Console.WriteLine(app.Environment.IsDevelopment().ToString());
173177
Console.WriteLine($"Running in {builder.Environment.EnvironmentName} mode");
178+
// Console.WriteLine($"Running in Dev={isDev} mode");
174179

175180
// -----------------------------------------------------------------------------------------
176181
// Apply Authentication Middleware
177182

178-
app.UseAuthentication();
183+
app.UseAuthentication();
179184
app.UseAuthorization();
180185

181186
// -----------------------------------------------------------------------------------------
182187

183-
var IsDevelopment = app.Environment.IsDevelopment();
188+
// var IsDevelopment = app.Environment.IsDevelopment();
184189

185190
if (IsDevelopment)
186191
{

src/appsettings.Development.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
]
2727
},
2828
"ConnectionStrings": {
29-
"DefaultConnection": "Data Source=expensemanager.db;Pooling=True;"
29+
"DefaultConnection": "Data Source=yourlocalldb.db;Pooling=True;"
3030
}
3131
}

0 commit comments

Comments
 (0)