• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

karanshukla / openresto / 27471089835

13 Jun 2026 03:34PM UTC coverage: 83.466% (-5.1%) from 88.54%
27471089835

push

github

web-flow
Merge pull request #139 from karanshukla/dev-notifications

Push Notifications for Admins

3061 of 4109 branches covered (74.5%)

Branch coverage included in aggregate %.

101 of 497 new or added lines in 13 files covered. (20.32%)

6 existing lines in 5 files now uncovered.

7712 of 8798 relevant lines covered (87.66%)

62.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.05
/OpenRestoApi/Program.cs
1
using OpenRestoApi.Extensions;
2

3
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
20✔
4

5
if (!builder.Environment.IsEnvironment("Testing"))
20!
NEW
6
    builder.Configuration.AddJsonFile("appsettings.Local.json", optional: true, reloadOnChange: false);
×
7

8
// Ensure the app listens on the PORT environment variable for Railway, defaulting to 8080
9
builder.WebHost.UseUrls($"http://0.0.0.0:{Environment.GetEnvironmentVariable("PORT") ?? "8080"}");
20!
10

11
builder.WebHost.ConfigureKestrel(options =>
20✔
12
{
20✔
13
    options.AddServerHeader = false;
×
14
});
20✔
15

16
builder.Services.AddProblemDetails();
20✔
17
builder.Services.AddProjectDependencies();
20✔
18
builder.Services.AddCustomCors(builder.Configuration);
20✔
19
builder.Services.AddCustomRateLimiting(builder.Environment);
20✔
20
builder.Services.AddCustomAuthentication(builder.Configuration);
20✔
21

22
string connectionString = builder.Configuration.GetAppConnectionString(builder.Environment);
20✔
23
builder.Services.AddDatabaseSetup(connectionString, builder.Environment);
20✔
24

25
WebApplication app = builder.Build();
20✔
26

27
// Convert unhandled exceptions and bare status-code responses (404/405/etc.)
28
// into RFC 7807 ProblemDetails JSON. Must be one of the first middlewares so
29
// it can wrap the rest of the pipeline.
30
app.UseExceptionHandler();
20✔
31
app.UseStatusCodePages();
20✔
32

33
app.UseForwardedHeaders();
20✔
34

35
if (app.Environment.IsDevelopment() || app.Environment.IsEnvironment("Testing"))
20!
36
{
37
    app.MapOpenApi();
20✔
38
}
39

40
app.UseCors("AllowFrontend");
20✔
41

42
app.UseRateLimiter();
20✔
43

44
app.UseAuthentication();
20✔
45
app.UseAuthorization();
20✔
46

47
app.MapControllers();
20✔
48

49
// Anything under /api/* that isn't matched by a controller route returns a
50
// JSON ProblemDetails 404 — never the SPA's HTML index or an empty body.
51
app.MapFallback("/api/{**catchAll}", (HttpContext ctx) =>
20✔
52
    Results.Problem(
28✔
53
        statusCode: StatusCodes.Status404NotFound,
28✔
54
        title: "Not Found",
28✔
55
        detail: $"The requested API endpoint '{ctx.Request.Path}' does not exist."));
28✔
56

57
app.InitializeDatabase(connectionString, builder.Configuration);
20✔
58

59
// Health endpoint: JSON body (consistent with the rest of the API), and opted
60
// out of rate limiting so liveness probes / scanners never get throttled.
61
app.MapGet("/api/health", () => Results.Ok(new { status = "ok" }))
20✔
62
    .DisableRateLimiting();
20✔
63

64
app.Run();
20✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc