30 lines
747 B
C#
30 lines
747 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Net.Http;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Load Google Places API Key Securely (from appsettings.json or User Secrets)
|
|
builder.Configuration.AddUserSecrets<Program>();
|
|
|
|
// Register Google Places Service with HTTP Client
|
|
builder.Services.AddHttpClient<GooglePlacesService>();
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseAuthorization();
|
|
app.MapControllers();
|
|
app.Run();
|